<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
  <link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css' /><title>Query Documents &mdash; MongoDB Manual</title><link rel="shortcut icon" href="https://media.mongodb.org/favicon.ico" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="index" />

  <meta name="release" content="4.2.5"/>
  <meta name="version" content="4.2"/>
  <meta name="DC.Source" content="https://github.com/mongodb/docs/blob/v4.2/source/tutorial/query-documents.txt"/>
  <meta property="og:image" content="http://s3.amazonaws.com/info-mongodb-com/_com_assets/cms/mongodb-for-giant-ideas-bbab5c3cf8.png">
  <meta property="og:image:secure_url" content="https://webassets.mongodb.com/_com_assets/cms/mongodb-for-giant-ideas-bbab5c3cf8.png">
      <link rel="canonical" href="https://docs.mongodb.com/manual/tutorial/query-documents" /><meta content="MongoDB  Manual. How do I query documents, query top level fields, perform equality match, query with query operators, specify compound query conditions." name="description" />
<meta content="query, select from collection, select all, select conditions, filters, select where, criteria, greater than, less than, MongoDB Manual" name="keywords" />

  
   <link rel="stylesheet" href="../_static/mongodb-docs.css" type="text/css" />
   <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
   <link rel="stylesheet" href="../_static/css/navbar.min.css" type="text/css" />
    
    <script type="text/javascript" src="../_static/lib/jquery.min.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/lib/bootstrap.js"></script>
    <script type="text/javascript" src="../_static/lib/jquery.cookie.js"></script>
    <script type="text/javascript" src="../_static/controller.js"></script>
      <link rel="search" type="application/opensearchdescription+xml" href="https://docs.mongodb.com/osd.xml" title="MongoDB Help"/>
<link rel="author" title="About these documents" href="../about.html" />
<!-- <link rel="index" title="Index" href="../genindex.html" /> -->
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="MongoDB Manual" href="../index.html" />
<link rel="up" title="MongoDB CRUD Operations" href="../crud.html" />
<link rel="next" title="Query on Embedded/Nested Documents" href="query-embedded-documents.html" />
<link rel="prev" title="Insert Methods" href="../reference/insert-methods.html" /><script type='text/javascript'>
   var gptadslots=[];
   var googletag = googletag || {};
   googletag.cmd = googletag.cmd || [];
   (function(){ var gads = document.createElement('script');
      gads.async = true; gads.type = 'text/javascript';
      var useSSL = 'https:' == document.location.protocol;
      gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
      var node = document.getElementsByTagName('script')[0];
      node.parentNode.insertBefore(gads, node);
   })();
</script>

<script type="text/javascript">
   googletag.cmd.push(function() {

      var pathname = location.href;
      
      if ( (pathname.indexOf("auth") >= 0) || (pathname.indexOf("security") >= 0) ) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/security', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if ( (pathname.indexOf("crud") >= 0) ||  (pathname.indexOf("query") >= 0) || (pathname.indexOf("insert") >= 0) || (pathname.indexOf("update") >= 0) || (pathname.indexOf("remove") >= 0) || (pathname.indexOf("delete") >= 0) || (pathname.indexOf("aggregation") >= 0) ) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/crud', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("shard") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/sharding', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("replica") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/replication', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("model") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/data-modeling', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("administration") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/support', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("install-mongodb-on-windows") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/install-mongodb-on-windows', [160, 600], 'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("tutorial/getting-started") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/docs_server_gettingstarted', [160, 600], 'mongodb-docs-1').addService(googletag.pubads());
      } else {
         //Adslot 1 declaration
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      }
      googletag.pubads().enableSingleRequest();
      googletag.pubads().enableAsyncRendering();
      googletag.enableServices();
   });
</script></head>
<body data-project="manual" data-project-title="MongoDB Manual" data-branch="v4.2" data-enable-marian=1>
  <!-- Google Tag Manager -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-JQHP"
                    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push(
     {'gtm.start': new Date().getTime(),event:'gtm.js'}
   );var f=d.getElementsByTagName(s)[0],
   j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
   '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
   })(window,document,'script','dataLayer','GTM-JQHP');</script>
  <!-- End Google Tag Manager -->
<div id="navbar" data-navprops='{"links": [{"url": "https://docs.mongodb.com/manual/","text": "Server","active": true},{"url": "https://docs.mongodb.com/ecosystem/drivers/","text": "Drivers"},{"url": "https://docs.mongodb.com/cloud/","text": "Cloud"},{"url": "https://docs.mongodb.com/tools/","text": "Tools"},{"url": "https://docs.mongodb.com/guides/","text": "Guides"}]}'></div>
      <script>
        window.googleSearchCx = "017213726194841070573:WMX6838984"
	window.googleSearchPlaceholder = "Search Documentation"
        window.googleSearchResultsUrl = "http://docs.mongodb.com/manual/search/"
      </script>
    <script src="../_static/navbar.min.js"></script>
  

  <div class="content" >

   <div id="left-column">
         <aside id="sidebar" class="sidebar">
             
  <div class="sphinxsidebar" id="sphinxsidebar">
    <div id="sphinxsidebarwrapper" class="sphinxsidebarwrapper"><a href="javascript:void(0)" class="closeNav" id="closeNav">Close &times;</a>


<h3>
  <a class="index-link" href="../index.html">MongoDB Manual</a>
</h3>


    <div class="btn-group version-sidebar">
      <button type="button" class="version-button dropdown-toggle" data-toggle="dropdown">
        
        
        Version 4.2 (current)<span class="caret"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="master">
              
              Version 4.4 (upcoming)
            </a>
          </li>
        
          
          <li class="active">
          
            <a href="#" data-path="manual">
              
              Version 4.2 (current)
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v4.0">
              
              Version 4.0
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.6">
              
              Version 3.6
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.4">
              
              Version 3.4
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.2">
              
              Version 3.2
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.0">
              
              Version 3.0
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v2.6">
              
              Version 2.6
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v2.4">
              
              Version 2.4
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v2.2">
              
              Version 2.2
            </a>
          </li>
        
      </ul>
    </div>


<ul class="current"><li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a><ul><li class="toctree-l2"><a class="reference internal" href="getting-started.html">Getting Started</a></li><li class="toctree-l2"><a class="reference external" href="https://docs.atlas.mongodb.com/getting-started/">Create an Atlas Free Tier Cluster</a></li><li class="toctree-l2"><a class="reference internal" href="../core/databases-and-collections.html">Databases and Collections</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/views.html">Views</a></li><li class="toctree-l3"><a class="reference internal" href="../core/materialized-views.html">On-Demand Materialized Views</a></li><li class="toctree-l3"><a class="reference internal" href="../core/capped-collections.html">Capped Collections</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/document.html">Documents</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/bson-types.html">BSON Types</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/bson-type-comparison-order.html">Comparison/Sort Order</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/mongodb-extended-json.html">MongoDB Extended JSON (v2)</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/mongodb-extended-json-v1.html">MongoDB Extended JSON (v1)</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/install-community.html">Install MongoDB Community Edition</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/install-on-linux.html">Install on Linux</a><ul><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-red-hat.html">Install on Red Hat</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-on-red-hat-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-ubuntu.html">Install on Ubuntu</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-on-ubuntu-tarball.html">Install using .tgz Tarball</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/installation-ubuntu-community-troubleshooting.html">Troubleshoot Ubuntu Installation</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-debian.html">Install on Debian</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-on-debian-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-suse.html">Install on SUSE</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-on-suse-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-amazon.html">Install on Amazon</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-on-amazon-tarball.html">Install using .tgz Tarball</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="install-mongodb-on-os-x.html">Install on macOS</a><ul><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-os-x-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="install-mongodb-on-windows.html">Install on Windows</a><ul><li class="toctree-l4"><a class="reference internal" href="install-mongodb-on-windows-unattended.html">Install using msiexec.exe</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/install-enterprise.html">Install MongoDB Enterprise</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/install-enterprise-linux.html">Install on Linux</a><ul><li class="toctree-l4"><a class="reference internal" href="install-mongodb-enterprise-on-red-hat.html">Install on Red Hat</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-enterprise-on-red-hat-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-enterprise-on-ubuntu.html">Install on Ubuntu</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-enterprise-on-ubuntu-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-enterprise-on-debian.html">Install on Debian</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-enterprise-on-debian-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-enterprise-on-suse.html">Install on SUSE</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-enterprise-on-suse-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="install-mongodb-enterprise-on-amazon.html">Install on Amazon</a><ul><li class="toctree-l5"><a class="reference internal" href="install-mongodb-enterprise-on-amazon-tarball.html">Install using .tgz Tarball</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="install-mongodb-enterprise-on-os-x.html">Install on macOS</a></li><li class="toctree-l3"><a class="reference internal" href="install-mongodb-enterprise-on-windows.html">Install on Windows</a><ul><li class="toctree-l4"><a class="reference internal" href="install-mongodb-enterprise-on-windows-unattended.html">Install using msiexec.exe</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="install-mongodb-enterprise-with-docker.html">Install with Docker</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/upgrade-community-to-enterprise.html">Upgrade MongoDB Community to MongoDB Enterprise</a><ul><li class="toctree-l3"><a class="reference internal" href="upgrade-to-enterprise-standalone.html">Upgrade to MongoDB Enterprise (Standalone)</a></li><li class="toctree-l3"><a class="reference internal" href="upgrade-to-enterprise-replica-set.html">Upgrade to MongoDB Enterprise (Replica Set)</a></li><li class="toctree-l3"><a class="reference internal" href="upgrade-to-enterprise-sharded-cluster.html">Upgrade to MongoDB Enterprise (Sharded Cluster)</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="verify-mongodb-packages.html">Verify Integrity of MongoDB Packages</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../mongo.html">The <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a><ul><li class="toctree-l2"><a class="reference internal" href="configure-mongo-shell.html">Configure the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li><li class="toctree-l2"><a class="reference internal" href="access-mongo-shell-help.html">Access the <code class="docutils literal"><span class="pre">mongo</span></code> Shell Help</a></li><li class="toctree-l2"><a class="reference internal" href="write-scripts-for-the-mongo-shell.html">Write Scripts for the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li><li class="toctree-l2"><a class="reference internal" href="../core/shell-types.html">Data Types in the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/mongo-shell.html"><code class="docutils literal"><span class="pre">mongo</span></code> Shell Quick Reference</a></li></ul></li><li class="toctree-l1 current"><a class="reference internal" href="../crud.html">MongoDB CRUD Operations</a><ul class="current"><li class="toctree-l2"><a class="reference internal" href="insert-documents.html">Insert Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/insert-methods.html">Insert Methods</a></li></ul></li><li class="toctree-l2 current"><a class="reference internal current" href="">Query Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="query-embedded-documents.html">Query on Embedded/Nested Documents</a></li><li class="toctree-l3"><a class="reference internal" href="query-arrays.html">Query an Array</a></li><li class="toctree-l3"><a class="reference internal" href="query-array-of-documents.html">Query an Array of Embedded Documents</a></li><li class="toctree-l3"><a class="reference internal" href="project-fields-from-query-results.html">Project Fields to Return from Query</a></li><li class="toctree-l3"><a class="reference internal" href="query-for-null-fields.html">Query for Null or Missing Fields</a></li><li class="toctree-l3"><a class="reference internal" href="iterate-a-cursor.html">Iterate a Cursor in the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="update-documents.html">Update Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="update-documents-with-aggregation-pipeline.html">Updates with Aggregation Pipeline</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/update-methods.html">Update Methods</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="remove-documents.html">Delete Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/delete-methods.html">Delete Methods</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/bulk-write-operations.html">Bulk Write Operations</a></li><li class="toctree-l2"><a class="reference internal" href="../core/retryable-writes.html">Retryable Writes</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/sql-comparison.html">SQL to MongoDB Mapping Chart</a></li><li class="toctree-l2"><a class="reference internal" href="../text-search.html">Text Search</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/link-text-indexes.html">Text Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/text-search-operators.html">Text Search Operators</a></li><li class="toctree-l3"><a class="reference internal" href="text-search-in-aggregation.html">Text Search in the Aggregation Pipeline</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/text-search-languages.html">Text Search Languages</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../geospatial-queries.html">Geospatial Queries</a><ul><li class="toctree-l3"><a class="reference internal" href="geospatial-tutorial.html">Find Restaurants with Geospatial Queries</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/geojson.html">GeoJSON Objects</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/read-concern.html">Read Isolation (Read Concern)</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-local.html">Read Concern <code class="docutils literal"><span class="pre">&quot;local&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-available.html">Read Concern <code class="docutils literal"><span class="pre">&quot;available&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-majority.html">Read Concern <code class="docutils literal"><span class="pre">&quot;majority&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-linearizable.html">Read Concern <code class="docutils literal"><span class="pre">&quot;linearizable&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-snapshot.html">Read Concern <code class="docutils literal"><span class="pre">&quot;snapshot&quot;</span></code></a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/write-concern.html">Write Acknowledgement (Write Concern)</a></li><li class="toctree-l2"><a class="reference internal" href="../core/crud.html">MongoDB CRUD Concepts</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/write-operations-atomicity.html">Atomicity and Transactions</a></li><li class="toctree-l3"><a class="reference internal" href="../core/read-isolation-consistency-recency.html">Read Isolation, Consistency, and Recency</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/causal-consistency-read-write-concerns.html">Causal Consistency and Read and Write Concerns</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/distributed-queries.html">Distributed Queries</a></li><li class="toctree-l3"><a class="reference internal" href="perform-findAndModify-linearizable-reads.html">Linearizable Reads via <code class="docutils literal"><span class="pre">findAndModify</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../core/query-plans.html">Query Plans</a></li><li class="toctree-l3"><a class="reference internal" href="../core/query-optimization.html">Query Optimization</a><ul><li class="toctree-l4"><a class="reference internal" href="evaluate-operation-performance.html">Evaluate Performance of Current Operations</a></li><li class="toctree-l4"><a class="reference internal" href="optimize-query-performance-with-indexes-and-projections.html">Optimize Query Performance</a></li><li class="toctree-l4"><a class="reference internal" href="../core/write-performance.html">Write Operation Performance</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/explain-results.html">Explain Results</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="analyze-query-plan.html">Analyze Query Performance</a></li><li class="toctree-l3"><a class="reference internal" href="../core/tailable-cursors.html">Tailable Cursors</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../aggregation.html">Aggregation</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/aggregation-pipeline.html">Aggregation Pipeline</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/aggregation-pipeline-optimization.html">Aggregation Pipeline Optimization</a></li><li class="toctree-l3"><a class="reference internal" href="../core/aggregation-pipeline-limits.html">Aggregation Pipeline Limits</a></li><li class="toctree-l3"><a class="reference internal" href="../core/aggregation-pipeline-sharded-collections.html">Aggregation Pipeline and Sharded Collections</a></li><li class="toctree-l3"><a class="reference internal" href="aggregation-zip-code-data-set.html">Example with ZIP Code Data</a></li><li class="toctree-l3"><a class="reference internal" href="aggregation-with-user-preference-data.html">Example with User Preference Data</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/map-reduce.html">Map-Reduce</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/map-reduce-sharded-collections.html">Map-Reduce and Sharded Collections</a></li><li class="toctree-l3"><a class="reference internal" href="../core/map-reduce-concurrency.html">Map-Reduce Concurrency</a></li><li class="toctree-l3"><a class="reference internal" href="map-reduce-examples.html">Map-Reduce Examples</a></li><li class="toctree-l3"><a class="reference internal" href="perform-incremental-map-reduce.html">Perform Incremental Map-Reduce</a></li><li class="toctree-l3"><a class="reference internal" href="troubleshoot-map-function.html">Troubleshoot the Map Function</a></li><li class="toctree-l3"><a class="reference internal" href="troubleshoot-reduce-function.html">Troubleshoot the Reduce Function</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/aggregation.html">Aggregation Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../meta/aggregation-quick-reference.html">Aggregation Pipeline Quick Reference</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/aggregation/interface.html">Aggregation Commands</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/aggregation-commands-comparison.html">Aggregation Commands Comparison</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/aggregation-variables.html">Variables in Aggregation Expressions</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/sql-aggregation-comparison.html">SQL to Aggregation Mapping Chart</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../data-modeling.html">Data Models</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/data-modeling-introduction.html">Data Modeling Introduction</a></li><li class="toctree-l2"><a class="reference internal" href="../core/schema-validation.html">Schema Validation</a></li><li class="toctree-l2"><a class="reference internal" href="../core/data-models.html">Data Modeling Concepts</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/data-model-design.html">Data Model Design</a></li><li class="toctree-l3"><a class="reference internal" href="../core/data-model-operations.html">Operational Factors and Data Models</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../applications/data-models.html">Data Model Examples and Patterns</a><ul><li class="toctree-l3"><a class="reference internal" href="../applications/data-models-relationships.html">Model Relationships Between Documents</a><ul><li class="toctree-l4"><a class="reference internal" href="model-embedded-one-to-one-relationships-between-documents.html">Model One-to-One Relationships with Embedded Documents</a></li><li class="toctree-l4"><a class="reference internal" href="model-embedded-one-to-many-relationships-between-documents.html">Model One-to-Many Relationships with Embedded Documents</a></li><li class="toctree-l4"><a class="reference internal" href="model-referenced-one-to-many-relationships-between-documents.html">Model One-to-Many Relationships with Document References</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../applications/data-models-tree-structures.html">Model Tree Structures</a><ul><li class="toctree-l4"><a class="reference internal" href="model-tree-structures-with-parent-references.html">Model Tree Structures with Parent References</a></li><li class="toctree-l4"><a class="reference internal" href="model-tree-structures-with-child-references.html">Model Tree Structures with Child References</a></li><li class="toctree-l4"><a class="reference internal" href="model-tree-structures-with-ancestors-array.html">Model Tree Structures with an Array of Ancestors</a></li><li class="toctree-l4"><a class="reference internal" href="model-tree-structures-with-materialized-paths.html">Model Tree Structures with Materialized Paths</a></li><li class="toctree-l4"><a class="reference internal" href="model-tree-structures-with-nested-sets.html">Model Tree Structures with Nested Sets</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../applications/data-models-applications.html">Model Specific Application Contexts</a><ul><li class="toctree-l4"><a class="reference internal" href="model-data-for-atomic-operations.html">Model Data for Atomic Operations</a></li><li class="toctree-l4"><a class="reference internal" href="model-data-for-keyword-search.html">Model Data to Support Keyword Search</a></li><li class="toctree-l4"><a class="reference internal" href="model-data-for-schema-versioning.html">Model Data for Schema Versioning</a></li><li class="toctree-l4"><a class="reference internal" href="model-monetary-data.html">Model Monetary Data</a></li><li class="toctree-l4"><a class="reference internal" href="model-time-data.html">Model Time Data</a></li><li class="toctree-l4"><a class="reference internal" href="model-computed-data.html">Model Computed Data</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/data-models.html">Data Model Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/database-references.html">Database References</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../core/transactions.html">Transactions</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/transactions-in-applications.html">Drivers API</a></li><li class="toctree-l2"><a class="reference internal" href="../core/transactions-production-consideration.html">Production Considerations</a></li><li class="toctree-l2"><a class="reference internal" href="../core/transactions-sharded-clusters.html">Production Considerations (Sharded Clusters)</a></li><li class="toctree-l2"><a class="reference internal" href="../core/transactions-operations.html">Transactions and Operations</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../indexes.html">Indexes</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/index-single.html">Single Field Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../core/index-compound.html">Compound Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../core/index-multikey.html">Multikey Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/multikey-index-bounds.html">Multikey Index Bounds</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-text.html">Text Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="specify-language-for-text-index.html">Specify a Language for Text Index</a></li><li class="toctree-l3"><a class="reference internal" href="avoid-text-index-name-limit.html">Specify Name for <code class="docutils literal"><span class="pre">text</span></code> Index</a></li><li class="toctree-l3"><a class="reference internal" href="control-results-of-text-search.html">Control Search Results with Weights</a></li><li class="toctree-l3"><a class="reference internal" href="limit-number-of-items-scanned-for-text-search.html">Limit the Number of Entries Scanned</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-wildcard.html">Wildcard Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/index-wildcard-restrictions.html">Wildcard Index Restrictions</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/2dsphere.html"><code class="docutils literal"><span class="pre">2dsphere</span></code> Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="query-a-2dsphere-index.html">Query a <code class="docutils literal"><span class="pre">2dsphere</span></code> Index</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/2d.html"><code class="docutils literal"><span class="pre">2d</span></code> Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="build-a-2d-index.html">Create a <code class="docutils literal"><span class="pre">2d</span></code> Index</a></li><li class="toctree-l3"><a class="reference internal" href="query-a-2d-index.html">Query a <code class="docutils literal"><span class="pre">2d</span></code> Index</a></li><li class="toctree-l3"><a class="reference internal" href="../core/geospatial-indexes.html"><code class="docutils literal"><span class="pre">2d</span></code> Index Internals</a></li><li class="toctree-l3"><a class="reference internal" href="calculate-distances-using-spherical-geometry-with-2d-geospatial-indexes.html">Calculate Distance Using Spherical Geometry</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/geohaystack.html"><code class="docutils literal"><span class="pre">geoHaystack</span></code> Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="build-a-geohaystack-index.html">Create a Haystack Index</a></li><li class="toctree-l3"><a class="reference internal" href="query-a-geohaystack-index.html">Query a Haystack Index</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-hashed.html">Hashed Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../core/index-properties.html">Index Properties</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/index-ttl.html">TTL Indexes</a><ul><li class="toctree-l4"><a class="reference internal" href="expire-data.html">Expire Data from Collections by Setting TTL</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/index-unique.html">Unique Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/index-partial.html">Partial Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/index-case-insensitive.html">Case Insensitive Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/index-sparse.html">Sparse Indexes</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-creation.html">Index Builds on Populated Collections</a><ul><li class="toctree-l3"><a class="reference internal" href="build-indexes-on-replica-sets.html">Build Indexes on Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="build-indexes-on-sharded-clusters.html">Build Indexes on Sharded Clusters</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-intersection.html">Index Intersection</a></li><li class="toctree-l2"><a class="reference internal" href="manage-indexes.html">Manage Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="measure-index-use.html">Measure Index Use</a></li><li class="toctree-l2"><a class="reference internal" href="../applications/indexes.html">Indexing Strategies</a><ul><li class="toctree-l3"><a class="reference internal" href="create-indexes-to-support-queries.html">Create Indexes to Support Your Queries</a></li><li class="toctree-l3"><a class="reference internal" href="sort-results-with-indexes.html">Use Indexes to Sort Query Results</a></li><li class="toctree-l3"><a class="reference internal" href="ensure-indexes-fit-ram.html">Ensure Indexes Fit in RAM</a></li><li class="toctree-l3"><a class="reference internal" href="create-queries-that-ensure-selectivity.html">Create Queries that Ensure Selectivity</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/indexes.html">Indexing Reference</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../security.html">Security</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/security-checklist.html">Security Checklist</a></li><li class="toctree-l2"><a class="reference internal" href="enable-authentication.html">Enable Access Control</a></li><li class="toctree-l2"><a class="reference internal" href="../core/authentication.html">Authentication</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/security-users.html">Users</a><ul><li class="toctree-l4"><a class="reference internal" href="create-users.html">Add Users</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/authentication-mechanisms.html">Authentication Mechanisms</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/security-scram.html">SCRAM</a></li><li class="toctree-l4"><a class="reference internal" href="../core/security-x.509.html">x.509</a><ul><li class="toctree-l5"><a class="reference internal" href="configure-x509-client-authentication.html">Use x.509 Certificates to Authenticate Clients</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/authentication-mechanisms-enterprise.html">Enterprise Authentication Mechanisms</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/kerberos.html">Kerberos Authentication</a><ul><li class="toctree-l5"><a class="reference internal" href="control-access-to-mongodb-with-kerberos-authentication.html">Configure MongoDB with Kerberos Authentication on Linux</a></li><li class="toctree-l5"><a class="reference internal" href="control-access-to-mongodb-windows-with-kerberos-authentication.html">Configure MongoDB with Kerberos Authentication on Windows</a></li><li class="toctree-l5"><a class="reference internal" href="troubleshoot-kerberos.html">Troubleshoot Kerberos Authentication</a></li><li class="toctree-l5"><a class="reference internal" href="kerberos-auth-activedirectory-authz.html">Configure MongoDB with Kerberos Authentication and Active Directory Authorization</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../core/security-ldap.html">LDAP Proxy Authentication</a><ul><li class="toctree-l5"><a class="reference internal" href="configure-ldap-sasl-activedirectory.html">Authenticate Using SASL and LDAP with ActiveDirectory</a></li><li class="toctree-l5"><a class="reference internal" href="configure-ldap-sasl-openldap.html">Authenticate Using SASL and LDAP with OpenLDAP</a></li><li class="toctree-l5"><a class="reference internal" href="authenticate-nativeldap-activedirectory.html">Authenticate and Authorize Users Using Active Directory via Native LDAP</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../core/security-ldap-external.html">LDAP Authorization</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/security-internal-authentication.html">Internal/Membership Authentication</a><ul><li class="toctree-l4"><a class="reference internal" href="deploy-replica-set-with-keyfile-access-control.html">Deploy Replica Set With Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="enforce-keyfile-access-control-in-existing-replica-set.html">Update Replica Set to Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="enforce-keyfile-access-control-in-existing-replica-set-without-downtime.html">Update Replica Set to Keyfile Authentication (No Downtime)</a></li><li class="toctree-l4"><a class="reference internal" href="rotate-key-replica-set.html">Rotate Keys for Replica Sets</a></li><li class="toctree-l4"><a class="reference internal" href="deploy-sharded-cluster-with-keyfile-access-control.html">Deploy Sharded Cluster with Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="enforce-keyfile-access-control-in-existing-sharded-cluster.html">Update Sharded Cluster to Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime.html">Update Sharded Cluster to Keyfile Authentication (No Downtime)</a></li><li class="toctree-l4"><a class="reference internal" href="rotate-key-sharded-cluster.html">Rotate Keys for Sharded Clusters</a></li><li class="toctree-l4"><a class="reference internal" href="configure-x509-member-authentication.html">Use x.509 Certificate for Membership Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="upgrade-keyfile-to-x509.html">Upgrade from Keyfile Authentication to x.509 Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="rotate-x509-membership-certificates.html">Rolling Update of x.509 Cluster Certificates that Contain New DN</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/authorization.html">Role-Based Access Control</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/built-in-roles.html">Built-In Roles</a></li><li class="toctree-l3"><a class="reference internal" href="../core/security-user-defined-roles.html">User-Defined Roles</a></li><li class="toctree-l3"><a class="reference internal" href="manage-users-and-roles.html">Manage Users and Roles</a></li><li class="toctree-l3"><a class="reference internal" href="change-own-password-and-custom-data.html">Change Your Password and Custom Data</a></li><li class="toctree-l3"><a class="reference internal" href="../core/collection-level-access-control.html">Collection-Level Access Control</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-transport-encryption.html">TLS/SSL (Transport Encryption)</a><ul><li class="toctree-l3"><a class="reference internal" href="configure-ssl.html">Configure <code class="docutils literal"><span class="pre">mongod</span></code> and <code class="docutils literal"><span class="pre">mongos</span></code> for TLS/SSL</a></li><li class="toctree-l3"><a class="reference internal" href="configure-ssl-clients.html">TLS/SSL Configuration for Clients</a></li><li class="toctree-l3"><a class="reference internal" href="upgrade-cluster-to-ssl.html">Upgrade a Cluster to Use TLS/SSL</a></li><li class="toctree-l3"><a class="reference internal" href="configure-fips.html">Configure MongoDB for FIPS</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-encryption-at-rest.html">Encryption at Rest</a><ul><li class="toctree-l3"><a class="reference internal" href="configure-encryption.html">Configure Encryption</a></li><li class="toctree-l3"><a class="reference internal" href="rotate-encryption-key.html">Rotate Encryption Keys</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-client-side-encryption.html">Client-Side Field Level Encryption</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/security-automatic-client-side-encryption.html">Automatic Client-Side Field Level Encryption</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/security-client-side-automatic-json-schema.html">Automatic Encryption Rules</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/security-client-side-query-aggregation-support.html">Read/Write Support with Automatic Field Level Encryption</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/security-client-side-encryption-appendix.html">Appendix</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/security-explicit-client-side-encryption.html">Explicit (Manual) Client-Side Field Level Encryption</a></li><li class="toctree-l3"><a class="reference internal" href="../core/security-client-side-encryption-key-management.html">Master Key and Data Encryption Key Management</a><ul><li class="toctree-l4"><a class="reference internal" href="manage-client-side-encryption-data-keys.html">Manage Data Encryption Keys</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/security-client-side-encryption-limitations.html">Limitations</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/auditing.html">Auditing</a><ul><li class="toctree-l3"><a class="reference internal" href="configure-auditing.html">Configure Auditing</a></li><li class="toctree-l3"><a class="reference internal" href="configure-audit-filters.html">Configure Audit Filters</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/audit-message.html">System Event Audit Messages</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-hardening.html">Network and Configuration Hardening</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/security-mongodb-configuration.html">IP Binding</a></li><li class="toctree-l3"><a class="reference internal" href="configure-linux-iptables-firewall.html">Configure Linux <code class="docutils literal"><span class="pre">iptables</span></code> Firewall for MongoDB</a></li><li class="toctree-l3"><a class="reference internal" href="configure-windows-netsh-firewall.html">Configure Windows <code class="docutils literal"><span class="pre">netsh</span></code> Firewall for MongoDB</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="implement-field-level-redaction.html">Implement Field Level Redaction</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/security.html">Security Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/system-roles-collection.html"><code class="docutils literal"><span class="pre">system.roles</span></code> Collection</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/system-users-collection.html"><code class="docutils literal"><span class="pre">system.users</span></code> Collection</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/resource-document.html">Resource Document</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/privilege-actions.html">Privilege Actions</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="create-a-vulnerability-report.html">Create a Vulnerability Report</a></li><li class="toctree-l2"><a class="reference internal" href="../appendix/security.html">Appendix</a><ul><li class="toctree-l3"><a class="reference internal" href="../appendix/security/appendixA-openssl-ca.html">Appendix A - OpenSSL CA Certificate for Testing</a></li><li class="toctree-l3"><a class="reference internal" href="../appendix/security/appendixB-openssl-server.html">Appendix B - OpenSSL Server Certificates for Testing</a></li><li class="toctree-l3"><a class="reference internal" href="../appendix/security/appendixC-openssl-client.html">Appendix C - OpenSSL Client Certificates for Testing</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../changeStreams.html">Change Streams</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/change-streams-production-recommendations.html">Change Streams Production Recommendations</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/change-events.html">Change Events</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../replication.html">Replication</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-members.html">Replica Set Members</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-primary.html">Replica Set Primary</a></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-secondary.html">Replica Set Secondary Members</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/replica-set-priority-0-member.html">Priority 0 Replica Set Members</a></li><li class="toctree-l4"><a class="reference internal" href="../core/replica-set-hidden-member.html">Hidden Replica Set Members</a></li><li class="toctree-l4"><a class="reference internal" href="../core/replica-set-delayed-member.html">Delayed Replica Set Members</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-arbiter.html">Replica Set Arbiter</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-oplog.html">Replica Set Oplog</a></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-sync.html">Replica Set Data Synchronization</a></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-architectures.html">Replica Set Deployment Architectures</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-architecture-three-members.html">Three Member Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-architecture-geographically-distributed.html">Replica Sets Distributed Across Two or More Data Centers</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-high-availability.html">Replica Set High Availability</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-elections.html">Replica Set Elections</a></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-rollbacks.html">Rollbacks During Replica Set Failover</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../applications/replication.html">Replica Set Read and Write Semantics</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-write-concern.html">Write Concern for Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../core/read-preference.html">Read Preference</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/read-preference-tags.html">Tag Sets</a></li><li class="toctree-l4"><a class="reference internal" href="../core/read-preference-staleness.html">maxStalenessSeconds</a></li><li class="toctree-l4"><a class="reference internal" href="../core/read-preference-use-cases.html">Read Preference Use Cases</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/read-preference-mechanics.html">Server Selection Algorithm</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/replica-set-deployment.html">Replica Set Deployment Tutorials</a><ul><li class="toctree-l3"><a class="reference internal" href="deploy-replica-set.html">Deploy a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="deploy-replica-set-for-testing.html">Deploy a Replica Set for Testing and Development</a></li><li class="toctree-l3"><a class="reference internal" href="deploy-geographically-distributed-replica-set.html">Deploy a Geographically Redundant Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="add-replica-set-arbiter.html">Add an Arbiter to Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="convert-standalone-to-replica-set.html">Convert a Standalone to a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="expand-replica-set.html">Add Members to a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="remove-replica-set-member.html">Remove Members from Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="replace-replica-set-member.html">Replace a Replica Set Member</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/replica-set-member-configuration.html">Member Configuration Tutorials</a><ul><li class="toctree-l3"><a class="reference internal" href="adjust-replica-set-member-priority.html">Adjust Priority for Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="configure-secondary-only-replica-set-member.html">Prevent Secondary from Becoming Primary</a></li><li class="toctree-l3"><a class="reference internal" href="configure-a-hidden-replica-set-member.html">Configure a Hidden Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="configure-a-delayed-replica-set-member.html">Configure a Delayed Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="configure-a-non-voting-replica-set-member.html">Configure Non-Voting Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="convert-secondary-into-arbiter.html">Convert a Secondary to an Arbiter</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/replica-set-maintenance.html">Replica Set Maintenance Tutorials</a><ul><li class="toctree-l3"><a class="reference internal" href="change-oplog-size.html">Change the Size of the Oplog</a></li><li class="toctree-l3"><a class="reference internal" href="perform-maintence-on-replica-set-members.html">Perform Maintenance on Replica Set Members</a></li><li class="toctree-l3"><a class="reference internal" href="force-member-to-be-primary.html">Force a Member to Become Primary</a></li><li class="toctree-l3"><a class="reference internal" href="resync-replica-set-member.html">Resync a Member of a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="configure-replica-set-tag-sets.html">Configure Replica Set Tag Sets</a></li><li class="toctree-l3"><a class="reference internal" href="reconfigure-replica-set-with-unavailable-members.html">Reconfigure a Replica Set with Unavailable Members</a></li><li class="toctree-l3"><a class="reference internal" href="manage-chained-replication.html">Manage Chained Replication</a></li><li class="toctree-l3"><a class="reference internal" href="change-hostnames-in-a-replica-set.html">Change Hostnames in a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="configure-replica-set-secondary-sync-target.html">Configure a Secondary’s Sync Target</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/replication.html">Replication Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/replica-configuration.html">Replica Set Configuration</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/replica-set-protocol-versions.html">Replica Set Protocol Version</a></li><li class="toctree-l3"><a class="reference internal" href="troubleshoot-replica-sets.html">Troubleshoot Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/local-database.html">The <code class="docutils literal"><span class="pre">local</span></code> Database</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/replica-states.html">Replica Set Member States</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../sharding.html">Sharding</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/sharded-cluster-components.html">Sharded Cluster Components</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-shards.html">Shards</a></li><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-config-servers.html">Config Servers (metadata)</a></li><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-query-router.html">Router (mongos)</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/sharding-shard-key.html">Shard Keys</a></li><li class="toctree-l2"><a class="reference internal" href="../core/hashed-sharding.html">Hashed Sharding</a></li><li class="toctree-l2"><a class="reference internal" href="../core/ranged-sharding.html">Ranged Sharding</a></li><li class="toctree-l2"><a class="reference internal" href="deploy-shard-cluster.html">Deploy a Sharded Cluster</a></li><li class="toctree-l2"><a class="reference internal" href="../core/zone-sharding.html">Zones</a><ul><li class="toctree-l3"><a class="reference internal" href="manage-shard-zone.html">Manage Shard Zones</a></li><li class="toctree-l3"><a class="reference internal" href="sharding-segmenting-data-by-location.html">Segmenting Data by Location</a></li><li class="toctree-l3"><a class="reference internal" href="sharding-tiered-hardware-for-varying-slas.html">Tiered Hardware for Varying SLA or SLO</a></li><li class="toctree-l3"><a class="reference internal" href="sharding-segmenting-shards.html">Segmenting Data by Application or Customer</a></li><li class="toctree-l3"><a class="reference internal" href="sharding-high-availability-writes.html">Distributed Local Writes for Insert Only Workloads</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/sharding-data-partitioning.html">Data Partitioning with Chunks</a><ul><li class="toctree-l3"><a class="reference internal" href="create-chunks-in-sharded-cluster.html">Create Chunks in a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="split-chunks-in-sharded-cluster.html">Split Chunks in a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="merge-chunks-in-sharded-cluster.html">Merge Chunks in a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="modify-chunk-size-in-sharded-cluster.html">Modify Chunk Size in a Sharded Cluster</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/sharding-balancer-administration.html">Balancer</a><ul><li class="toctree-l3"><a class="reference internal" href="manage-sharded-cluster-balancer.html">Manage Sharded Cluster Balancer</a></li><li class="toctree-l3"><a class="reference internal" href="migrate-chunks-in-sharded-cluster.html">Migrate Chunks in a Sharded Cluster</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/sharded-cluster-administration.html">Administration</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/sharded-cluster-config-servers.html">Config Server Administration</a><ul><li class="toctree-l4"><a class="reference internal" href="replace-config-server.html">Replace a Config Server</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="view-sharded-cluster-configuration.html">View Cluster Configuration</a></li><li class="toctree-l3"><a class="reference internal" href="restart-sharded-cluster.html">Restart a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="migrate-sharded-cluster-to-new-hardware.html">Migrate a Sharded Cluster to Different Hardware</a></li><li class="toctree-l3"><a class="reference internal" href="add-shards-to-shard-cluster.html">Add Shards to a Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="remove-shards-from-cluster.html">Remove Shards from an Existing Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="clear-jumbo-flag.html">Clear <code class="docutils literal"><span class="pre">jumbo</span></code> Flag</a></li><li class="toctree-l3"><a class="reference internal" href="backup-sharded-cluster-metadata.html">Back Up Cluster Metadata</a></li><li class="toctree-l3"><a class="reference internal" href="convert-sharded-cluster-to-replica-set.html">Convert Sharded Cluster to Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="convert-replica-set-to-replicated-shard-cluster.html">Convert a Replica Set to a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="convert-shard-standalone-to-shard-replica-set.html">Convert a Shard Standalone to a Shard Replica Set</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/sharding.html">Sharding Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-requirements.html">Operational Restrictions</a></li><li class="toctree-l3"><a class="reference internal" href="troubleshoot-sharded-clusters.html">Troubleshoot Sharded Clusters</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/config-database.html">Config Database</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../administration.html">Administration</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/production-notes.html">Production Notes</a></li><li class="toctree-l2"><a class="reference internal" href="../administration/production-checklist-operations.html">Operations Checklist</a></li><li class="toctree-l2"><a class="reference internal" href="../administration/production-checklist-development.html">Development Checklist</a></li><li class="toctree-l2"><a class="reference internal" href="../administration/analyzing-mongodb-performance.html">Performance</a><ul><li class="toctree-l3"><a class="reference internal" href="manage-the-database-profiler.html">Database Profiler</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/database-profiler.html">Database Profiler Output</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="transparent-huge-pages.html">Disable Transparent Huge Pages (THP)</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/ulimit.html">UNIX <code class="docutils literal"><span class="pre">ulimit</span></code> Settings</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/configuration-and-maintenance.html">Configuration and Maintenance</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/configuration.html">Run-time Database Configuration</a></li><li class="toctree-l3"><a class="reference internal" href="upgrade-revision.html">Upgrade to the Latest Revision of MongoDB</a></li><li class="toctree-l3"><a class="reference internal" href="manage-mongodb-processes.html">Manage <code class="docutils literal"><span class="pre">mongod</span></code> Processes</a></li><li class="toctree-l3"><a class="reference internal" href="terminate-running-operations.html">Terminate Running Operations</a></li><li class="toctree-l3"><a class="reference internal" href="rotate-log-files.html">Rotate Log Files</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../data-center-awareness.html">Data Center Awareness</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/workload-isolation.html">Workload Isolation in MongoDB Deployments</a></li><li class="toctree-l3"><a class="reference internal" href="../core/zone-sharding.html">Zones</a><ul><li class="toctree-l4"><a class="reference internal" href="manage-shard-zone.html">Manage Shard Zones</a></li><li class="toctree-l4"><a class="reference internal" href="sharding-segmenting-data-by-location.html">Segmenting Data by Location</a></li><li class="toctree-l4"><a class="reference internal" href="sharding-tiered-hardware-for-varying-slas.html">Tiered Hardware for Varying SLA or SLO</a></li><li class="toctree-l4"><a class="reference internal" href="sharding-segmenting-shards.html">Segmenting Data by Application or Customer</a></li><li class="toctree-l4"><a class="reference internal" href="sharding-high-availability-writes.html">Distributed Local Writes for Insert Only Workloads</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="manage-shard-zone.html">Manage Shard Zones</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/backups.html">MongoDB Backup Methods</a><ul><li class="toctree-l3"><a class="reference internal" href="backup-with-filesystem-snapshots.html">Back Up and Restore with Filesystem Snapshots</a></li><li class="toctree-l3"><a class="reference internal" href="backup-and-restore-tools.html">Back Up and Restore with MongoDB Tools</a></li><li class="toctree-l3"><a class="reference internal" href="restore-replica-set-from-backup.html">Restore a Replica Set from MongoDB Backups</a></li><li class="toctree-l3"><a class="reference internal" href="../administration/backup-sharded-clusters.html">Backup and Restore Sharded Clusters</a><ul><li class="toctree-l4"><a class="reference internal" href="backup-sharded-cluster-with-filesystem-snapshots.html">Back Up a Sharded Cluster with File System Snapshots</a></li><li class="toctree-l4"><a class="reference internal" href="backup-sharded-cluster-with-database-dumps.html">Back Up a Sharded Cluster with Database Dumps</a></li><li class="toctree-l4"><a class="reference internal" href="schedule-backup-window-for-sharded-clusters.html">Schedule Backup Window for Sharded Clusters</a></li><li class="toctree-l4"><a class="reference internal" href="restore-sharded-cluster.html">Restore a Sharded Cluster</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="recover-data-following-unexpected-shutdown.html">Recover a Standalone after an Unexpected Shutdown</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/monitoring.html">Monitoring for MongoDB</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/free-monitoring.html">Free Monitoring</a></li><li class="toctree-l3"><a class="reference internal" href="monitor-with-snmp.html">Monitor MongoDB With SNMP on Linux</a></li><li class="toctree-l3"><a class="reference internal" href="monitor-with-snmp-on-windows.html">Monitor MongoDB Windows with SNMP</a></li><li class="toctree-l3"><a class="reference internal" href="troubleshoot-snmp.html">Troubleshoot SNMP</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../storage.html">Storage</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/storage-engines.html">Storage Engines</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/wiredtiger.html">WiredTiger Storage Engine</a><ul><li class="toctree-l4"><a class="reference internal" href="change-standalone-wiredtiger.html">Change Standalone to WiredTiger</a></li><li class="toctree-l4"><a class="reference internal" href="change-replica-set-wiredtiger.html">Change Replica Set to WiredTiger</a></li><li class="toctree-l4"><a class="reference internal" href="change-sharded-cluster-wiredtiger.html">Change Sharded Cluster to WiredTiger</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/inmemory.html">In-Memory Storage Engine</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/journaling.html">Journaling</a><ul><li class="toctree-l3"><a class="reference internal" href="manage-journaling.html">Manage Journaling</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/gridfs.html">GridFS</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/storage.html">FAQ: MongoDB Storage</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a><ul><li class="toctree-l2"><a class="reference internal" href="../faq/fundamentals.html">FAQ: MongoDB Fundamentals</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/indexes.html">FAQ: Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/concurrency.html">FAQ: Concurrency</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/sharding.html">FAQ: Sharding with MongoDB</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/replica-sets.html">FAQ: Replication and Replica Sets</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/storage.html">FAQ: MongoDB Storage</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/diagnostics.html">FAQ: MongoDB Diagnostics</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../reference.html">Reference</a><ul><li class="toctree-l2"><a class="reference internal" href="../reference/operator.html">Operators</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/operator/query.html">Query and Projection Operators</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-comparison.html">Comparison Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/eq.html">$eq</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/gt.html">$gt</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/gte.html">$gte</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/in.html">$in</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/lt.html">$lt</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/lte.html">$lte</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/ne.html">$ne</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/nin.html">$nin</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-logical.html">Logical Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/and.html">$and</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/not.html">$not</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/nor.html">$nor</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/or.html">$or</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-element.html">Element Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/exists.html">$exists</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/type.html">$type</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-evaluation.html">Evaluation Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/expr.html">$expr</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/jsonSchema.html">$jsonSchema</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/mod.html">$mod</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/regex.html">$regex</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/text.html">$text</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/where.html">$where</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-geospatial.html">Geospatial Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/geoIntersects.html">$geoIntersects</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/geoWithin.html">$geoWithin</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/near.html">$near</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/nearSphere.html">$nearSphere</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/box.html">$box</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/center.html">$center</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/centerSphere.html">$centerSphere</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/geometry.html">$geometry</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/maxDistance.html">$maxDistance</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/minDistance.html">$minDistance</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/polygon.html">$polygon</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/uniqueDocs.html">$uniqueDocs</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-array.html">Array Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/all.html">$all</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/elemMatch.html">$elemMatch (query)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/size.html">$size</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-bitwise.html">Bitwise Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAllClear.html">$bitsAllClear</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAllSet.html">$bitsAllSet</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAnyClear.html">$bitsAnyClear</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAnySet.html">$bitsAnySet</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query/comment.html">$comment</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/projection.html">Projection Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/positional.html">$ (projection)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/elemMatch.html">$elemMatch (projection)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/meta.html">$meta</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/slice.html">$slice (projection)</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/update.html">Update Operators</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/update-field.html">Field Update Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/currentDate.html">$currentDate</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/inc.html">$inc</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/min.html">$min</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/max.html">$max</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/mul.html">$mul</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/rename.html">$rename</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/set.html">$set</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/setOnInsert.html">$setOnInsert</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/unset.html">$unset</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/update-array.html">Array Update Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/positional.html">$ (update)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/positional-all.html">$[]</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/positional-filtered.html">$[&lt;identifier&gt;]</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/addToSet.html">$addToSet</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/pop.html">$pop</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/pull.html">$pull</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/push.html">$push</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/pullAll.html">$pullAll</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/each.html">$each</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/position.html">$position</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/slice.html">$slice</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/sort.html">$sort</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/update-bitwise.html">Bitwise Update Operator</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/bit.html">$bit</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/aggregation-pipeline.html">Aggregation Pipeline Stages</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/addFields.html">$addFields (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/bucket.html">$bucket (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/bucketAuto.html">$bucketAuto (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/collStats.html">$collStats (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/count.html">$count (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/currentOp.html">$currentOp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/facet.html">$facet (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/geoNear.html">$geoNear (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/graphLookup.html">$graphLookup (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/group.html">$group (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexStats.html">$indexStats (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/limit.html">$limit (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/listLocalSessions.html">$listLocalSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/listSessions.html">$listSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/lookup.html">$lookup (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/match.html">$match (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/merge.html">$merge (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/out.html">$out (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/planCacheStats.html">$planCacheStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/project.html">$project (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/redact.html">$redact (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/replaceRoot.html">$replaceRoot (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/replaceWith.html">$replaceWith (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sample.html">$sample (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/set.html">$set (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/skip.html">$skip (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sort.html">$sort (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sortByCount.html">$sortByCount (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/unset.html">$unset (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/unwind.html">$unwind (aggregation)</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/aggregation.html">Aggregation Pipeline Operators</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/abs.html">$abs (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/acos.html">$acos (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/acosh.html">$acosh (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/add.html">$add (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/addToSet.html">$addToSet (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/allElementsTrue.html">$allElementsTrue (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/and.html">$and (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/anyElementTrue.html">$anyElementTrue (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/arrayElemAt.html">$arrayElemAt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/arrayToObject.html">$arrayToObject (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/asin.html">$asin (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/asinh.html">$asinh (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/atan.html">$atan (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/atan2.html">$atan2 (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/atanh.html">$atanh (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/avg.html">$avg (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ceil.html">$ceil (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/cmp.html">$cmp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/concat.html">$concat (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/concatArrays.html">$concatArrays (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/cond.html">$cond (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/convert.html">$convert (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/cos.html">$cos (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateFromParts.html">$dateFromParts (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateToParts.html">$dateToParts (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateFromString.html">$dateFromString (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateToString.html">$dateToString (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dayOfMonth.html">$dayOfMonth (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dayOfWeek.html">$dayOfWeek (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dayOfYear.html">$dayOfYear (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/degreesToRadians.html">$degreesToRadians (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/divide.html">$divide (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/eq.html">$eq (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/exp.html">$exp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/filter.html">$filter (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/first.html">$first (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/floor.html">$floor (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/gt.html">$gt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/gte.html">$gte (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/hour.html">$hour (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ifNull.html">$ifNull (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/in.html">$in (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexOfArray.html">$indexOfArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexOfBytes.html">$indexOfBytes (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexOfCP.html">$indexOfCP (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isArray.html">$isArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isoDayOfWeek.html">$isoDayOfWeek (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isoWeek.html">$isoWeek (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isoWeekYear.html">$isoWeekYear (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/last.html">$last (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/let.html">$let (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/literal.html">$literal (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ln.html">$ln (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/log.html">$log (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/log10.html">$log10 (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/lt.html">$lt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/lte.html">$lte (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ltrim.html">$ltrim (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/map.html">$map (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/max.html">$max (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/mergeObjects.html">$mergeObjects (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/meta.html">$meta (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/min.html">$min (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/millisecond.html">$millisecond (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/minute.html">$minute (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/mod.html">$mod (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/month.html">$month (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/multiply.html">$multiply (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ne.html">$ne (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/not.html">$not (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/objectToArray.html">$objectToArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/or.html">$or (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/pow.html">$pow (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/push.html">$push (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/radiansToDegrees.html">$radiansToDegrees (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/range.html">$range (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/reduce.html">$reduce (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/regexFind.html">$regexFind (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/regexFindAll.html">$regexFindAll (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/regexMatch.html">$regexMatch (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/reverseArray.html">$reverseArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/round.html">$round (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/rtrim.html">$rtrim (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/second.html">$second (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setDifference.html">$setDifference (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setEquals.html">$setEquals (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setIntersection.html">$setIntersection (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setIsSubset.html">$setIsSubset (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setUnion.html">$setUnion (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/size.html">$size (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sin.html">$sin (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/slice.html">$slice (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/split.html">$split (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sqrt.html">$sqrt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/stdDevPop.html">$stdDevPop (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/stdDevSamp.html">$stdDevSamp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/strcasecmp.html">$strcasecmp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/strLenBytes.html">$strLenBytes (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/strLenCP.html">$strLenCP (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/substr.html">$substr (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/substrBytes.html">$substrBytes (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/substrCP.html">$substrCP (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/subtract.html">$subtract (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sum.html">$sum (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/switch.html">$switch (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/tan.html">$tan (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toBool.html">$toBool (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toDate.html">$toDate (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toDecimal.html">$toDecimal (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toDouble.html">$toDouble(aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toInt.html">$toInt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toLong.html">$toLong (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toObjectId.html">$toObjectId (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toString.html">$toString (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toLower.html">$toLower (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toUpper.html">$toUpper (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/trim.html">$trim (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/trunc.html">$trunc (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/type.html">$type (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/week.html">$week (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/year.html">$year (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/zip.html">$zip (aggregation)</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/query-modifier.html">Query Modifiers</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/comment.html">$comment</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/explain.html">$explain</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/hint.html">$hint</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/max.html">$max</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/maxTimeMS.html">$maxTimeMS</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/min.html">$min</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/orderby.html">$orderby</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/query.html">$query</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/returnKey.html">$returnKey</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/showDiskLoc.html">$showDiskLoc</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/natural.html">$natural</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/command.html">Database Commands</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-aggregation.html">Aggregation Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/aggregate.html">aggregate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/count.html">count</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/distinct.html">distinct</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/mapReduce.html">mapReduce</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-geospatial.html">Geospatial Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/geoSearch.html">geoSearch</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-crud.html">Query and Write Operation Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/delete.html">delete</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/find.html">find</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/findAndModify.html">findAndModify</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getLastError.html">getLastError</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getMore.html">getMore</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/insert.html">insert</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/resetError.html">resetError</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/update.html">update</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-plan-cache.html">Query Plan Cache Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheClear.html">planCacheClear</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheClearFilters.html">planCacheClearFilters</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheListFilters.html">planCacheListFilters</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheListPlans.html">planCacheListPlans</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheListQueryShapes.html">planCacheListQueryShapes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheSetFilter.html">planCacheSetFilter</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-authentication.html">Authentication Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/authenticate.html">authenticate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getnonce.html">getnonce</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/logout.html">logout</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-user-management.html">User Management Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/createUser.html">createUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropAllUsersFromDatabase.html">dropAllUsersFromDatabase</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropUser.html">dropUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/grantRolesToUser.html">grantRolesToUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/revokeRolesFromUser.html">revokeRolesFromUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/updateUser.html">updateUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/usersInfo.html">usersInfo</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-role-management.html">Role Management Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/createRole.html">createRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropRole.html">dropRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropAllRolesFromDatabase.html">dropAllRolesFromDatabase</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/grantPrivilegesToRole.html">grantPrivilegesToRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/grantRolesToRole.html">grantRolesToRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/invalidateUserCache.html">invalidateUserCache</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/revokePrivilegesFromRole.html">revokePrivilegesFromRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/revokeRolesFromRole.html">revokeRolesFromRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/rolesInfo.html">rolesInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/updateRole.html">updateRole</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-replication.html">Replication Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/applyOps.html">applyOps</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/isMaster.html">isMaster</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetAbortPrimaryCatchUp.html">replSetAbortPrimaryCatchUp</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetFreeze.html">replSetFreeze</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetGetConfig.html">replSetGetConfig</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetGetStatus.html">replSetGetStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetInitiate.html">replSetInitiate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetMaintenance.html">replSetMaintenance</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetReconfig.html">replSetReconfig</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetResizeOplog.html">replSetResizeOplog</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetStepDown.html">replSetStepDown</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetSyncFrom.html">replSetSyncFrom</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-sharding.html">Sharding Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/addShard.html">addShard</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/addShardToZone.html">addShardToZone</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/balancerStart.html">balancerStart</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/balancerStatus.html">balancerStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/balancerStop.html">balancerStop</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/checkShardingIndex.html">checkShardingIndex</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/clearJumboFlag.html">clearJumboFlag</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cleanupOrphaned.html">cleanupOrphaned</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/enableSharding.html">enableSharding</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/flushRouterConfig.html">flushRouterConfig</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getShardMap.html">getShardMap</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getShardVersion.html">getShardVersion</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/isdbgrid.html">isdbgrid</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listShards.html">listShards</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/medianKey.html">medianKey</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/moveChunk.html">moveChunk</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/movePrimary.html">movePrimary</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/mergeChunks.html">mergeChunks</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/removeShard.html">removeShard</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/removeShardFromZone.html">removeShardFromZone</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setShardVersion.html">setShardVersion</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shardCollection.html">shardCollection</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shardingState.html">shardingState</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/split.html">split</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/splitChunk.html">splitChunk</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/splitVector.html">splitVector</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/unsetSharding.html">unsetSharding</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/updateZoneKeyRange.html">updateZoneKeyRange</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-sessions.html">Sessions Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/abortTransaction.html">abortTransaction</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/commitTransaction.html">commitTransaction</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/endSessions.html">endSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killAllSessions.html">killAllSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killAllSessionsByPattern.html">killAllSessionsByPattern</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killSessions.html">killSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/refreshSessions.html">refreshSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/startSession.html">startSession</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-administration.html">Administration Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/clean.html">clean</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cloneCollection.html">cloneCollection</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cloneCollectionAsCapped.html">cloneCollectionAsCapped</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/collMod.html">collMod</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/compact.html">compact</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/connPoolSync.html">connPoolSync</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/convertToCapped.html">convertToCapped</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/create.html">create</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/createIndexes.html">createIndexes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/currentOp.html">currentOp</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/drop.html">drop</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropDatabase.html">dropDatabase</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropConnections.html">dropConnections</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropIndexes.html">dropIndexes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/filemd5.html">filemd5</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/fsync.html">fsync</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/fsyncUnlock.html">fsyncUnlock</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getParameter.html">getParameter</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killCursors.html">killCursors</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killOp.html">killOp</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listCollections.html">listCollections</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listDatabases.html">listDatabases</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listIndexes.html">listIndexes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/logRotate.html">logRotate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/reIndex.html">reIndex</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/renameCollection.html">renameCollection</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setFeatureCompatibilityVersion.html">setFeatureCompatibilityVersion</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setParameter.html">setParameter</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shutdown.html">shutdown</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-diagnostic.html">Diagnostic Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/availableQueryOptions.html">availableQueryOptions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/buildInfo.html">buildInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/collStats.html">collStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/connPoolStats.html">connPoolStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/connectionStatus.html">connectionStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cursorInfo.html">cursorInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dataSize.html">dataSize</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dbHash.html">dbHash</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dbStats.html">dbStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/diagLogging.html">diagLogging</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/driverOIDTest.html">driverOIDTest</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/explain.html">explain</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/features.html">features</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getCmdLineOpts.html">getCmdLineOpts</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getLog.html">getLog</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/hostInfo.html">hostInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/isSelf.html">isSelf</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listCommands.html">listCommands</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/netstat.html">netstat</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/ping.html">ping</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/profile.html">profile</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/serverStatus.html">serverStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shardConnPoolStats.html">shardConnPoolStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/top.html">top</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/validate.html">validate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/whatsmyuri.html">whatsmyuri</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-free-monitoring.html">Free Monitoring Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/getFreeMonitoringStatus.html">getFreeMonitoringStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setFreeMonitoring.html">setFreeMonitoring</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-auditing.html">System Events Auditing Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/logApplicationMessage.html">logApplicationMessage</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/method.html"><code class="docutils literal"><span class="pre">mongo</span></code> Shell Methods</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-collection.html">Collection Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.aggregate.html">db.collection.aggregate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.bulkWrite.html">db.collection.bulkWrite()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.copyTo.html">db.collection.copyTo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.count.html">db.collection.count()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.countDocuments.html">db.collection.countDocuments()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.estimatedDocumentCount.html">db.collection.estimatedDocumentCount()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.createIndex.html">db.collection.createIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.createIndexes.html">db.collection.createIndexes()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.dataSize.html">db.collection.dataSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.deleteOne.html">db.collection.deleteOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.deleteMany.html">db.collection.deleteMany()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.distinct.html">db.collection.distinct()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.drop.html">db.collection.drop()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.dropIndex.html">db.collection.dropIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.dropIndexes.html">db.collection.dropIndexes()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.ensureIndex.html">db.collection.ensureIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.explain.html">db.collection.explain()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.find.html">db.collection.find()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findAndModify.html">db.collection.findAndModify()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOne.html">db.collection.findOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOneAndDelete.html">db.collection.findOneAndDelete()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOneAndReplace.html">db.collection.findOneAndReplace()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOneAndUpdate.html">db.collection.findOneAndUpdate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getIndexes.html">db.collection.getIndexes()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getShardDistribution.html">db.collection.getShardDistribution()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getShardVersion.html">db.collection.getShardVersion()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.insert.html">db.collection.insert()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.insertOne.html">db.collection.insertOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.insertMany.html">db.collection.insertMany()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.isCapped.html">db.collection.isCapped()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.latencyStats.html">db.collection.latencyStats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.mapReduce.html">db.collection.mapReduce()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.reIndex.html">db.collection.reIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.remove.html">db.collection.remove()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.renameCollection.html">db.collection.renameCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.replaceOne.html">db.collection.replaceOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.save.html">db.collection.save()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.stats.html">db.collection.stats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.storageSize.html">db.collection.storageSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.totalIndexSize.html">db.collection.totalIndexSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.totalSize.html">db.collection.totalSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.update.html">db.collection.update()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.updateOne.html">db.collection.updateOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.updateMany.html">db.collection.updateMany()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.watch.html">db.collection.watch()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.validate.html">db.collection.validate()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-cursor.html">Cursor Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.addOption.html">cursor.addOption()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.allowPartialResults.html">cursor.allowPartialResults()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.batchSize.html">cursor.batchSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.close.html">cursor.close()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.isClosed.html">cursor.isClosed()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.collation.html">cursor.collation()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.comment.html">cursor.comment()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.count.html">cursor.count()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.explain.html">cursor.explain()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.forEach.html">cursor.forEach()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.hasNext.html">cursor.hasNext()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.hint.html">cursor.hint()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.isExhausted.html">cursor.isExhausted()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.itcount.html">cursor.itcount()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.limit.html">cursor.limit()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.map.html">cursor.map()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.max.html">cursor.max()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.maxTimeMS.html">cursor.maxTimeMS()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.min.html">cursor.min()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.next.html">cursor.next()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.noCursorTimeout.html">cursor.noCursorTimeout()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.objsLeftInBatch.html">cursor.objsLeftInBatch()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.pretty.html">cursor.pretty()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.readConcern.html">cursor.readConcern()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.readPref.html">cursor.readPref()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.returnKey.html">cursor.returnKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.showRecordId.html">cursor.showRecordId()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.size.html">cursor.size()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.skip.html">cursor.skip()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.sort.html">cursor.sort()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.tailable.html">cursor.tailable()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.toArray.html">cursor.toArray()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-database.html">Database Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.adminCommand.html">db.adminCommand()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.aggregate.html">db.aggregate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.cloneCollection.html">db.cloneCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.cloneDatabase.html">db.cloneDatabase()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.commandHelp.html">db.commandHelp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.copyDatabase.html">db.copyDatabase()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createCollection.html">db.createCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createView.html">db.createView()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.currentOp.html">db.currentOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropDatabase.html">db.dropDatabase()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.eval.html">db.eval()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.fsyncLock.html">db.fsyncLock()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.fsyncUnlock.html">db.fsyncUnlock()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getCollection.html">db.getCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getCollectionInfos.html">db.getCollectionInfos()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getCollectionNames.html">db.getCollectionNames()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getLastError.html">db.getLastError()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getLastErrorObj.html">db.getLastErrorObj()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getLogComponents.html">db.getLogComponents()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getMongo.html">db.getMongo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getName.html">db.getName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getProfilingLevel.html">db.getProfilingLevel()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getProfilingStatus.html">db.getProfilingStatus()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getReplicationInfo.html">db.getReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getSiblingDB.html">db.getSiblingDB()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.help.html">db.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.hostInfo.html">db.hostInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.isMaster.html">db.isMaster()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.killOp.html">db.killOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.listCommands.html">db.listCommands()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.logout.html">db.logout()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printCollectionStats.html">db.printCollectionStats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printReplicationInfo.html">db.printReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printShardingStatus.html">db.printShardingStatus()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printSlaveReplicationInfo.html">db.printSlaveReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.resetError.html">db.resetError()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.runCommand.html">db.runCommand()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.serverBuildInfo.html">db.serverBuildInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.serverCmdLineOpts.html">db.serverCmdLineOpts()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.serverStatus.html">db.serverStatus()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.setLogLevel.html">db.setLogLevel()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.setProfilingLevel.html">db.setProfilingLevel()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.shutdownServer.html">db.shutdownServer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.stats.html">db.stats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.version.html">db.version()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.watch.html">db.watch()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-plan-cache.html">Query Plan Cache Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getPlanCache.html">db.collection.getPlanCache()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.clear.html">PlanCache.clear()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.clearPlansByQuery.html">PlanCache.clearPlansByQuery()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.getPlansByQuery.html">PlanCache.getPlansByQuery()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.help.html">PlanCache.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.listQueryShapes.html">PlanCache.listQueryShapes()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-bulk.html">Bulk Operation Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.initializeOrderedBulkOp.html">db.collection.initializeOrderedBulkOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.initializeUnorderedBulkOp.html">db.collection.initializeUnorderedBulkOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.html">Bulk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.execute.html">Bulk.execute()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.html">Bulk.find()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.arrayFilters.html">Bulk.find.arrayFilters()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.collation.html">Bulk.find.collation()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.hint.html">Bulk.find.hint()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.remove.html">Bulk.find.remove()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.removeOne.html">Bulk.find.removeOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.replaceOne.html">Bulk.find.replaceOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.updateOne.html">Bulk.find.updateOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.update.html">Bulk.find.update()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.upsert.html">Bulk.find.upsert()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.getOperations.html">Bulk.getOperations()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.insert.html">Bulk.insert()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.tojson.html">Bulk.tojson()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.toString.html">Bulk.toString()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-user-management.html">User Management Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.auth.html">db.auth()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.changeUserPassword.html">db.changeUserPassword()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createUser.html">db.createUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropUser.html">db.dropUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropAllUsers.html">db.dropAllUsers()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getUser.html">db.getUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getUsers.html">db.getUsers()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.grantRolesToUser.html">db.grantRolesToUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.removeUser.html">db.removeUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.revokeRolesFromUser.html">db.revokeRolesFromUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.updateUser.html">db.updateUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/passwordPrompt.html">passwordPrompt()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-role-management.html">Role Management Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createRole.html">db.createRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropRole.html">db.dropRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropAllRoles.html">db.dropAllRoles()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getRole.html">db.getRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getRoles.html">db.getRoles()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.grantPrivilegesToRole.html">db.grantPrivilegesToRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.revokePrivilegesFromRole.html">db.revokePrivilegesFromRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.grantRolesToRole.html">db.grantRolesToRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.revokeRolesFromRole.html">db.revokeRolesFromRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.updateRole.html">db.updateRole()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-replication.html">Replication Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.add.html">rs.add()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.addArb.html">rs.addArb()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.conf.html">rs.conf()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.freeze.html">rs.freeze()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.help.html">rs.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.initiate.html">rs.initiate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.printReplicationInfo.html">rs.printReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.printSlaveReplicationInfo.html">rs.printSlaveReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.reconfig.html">rs.reconfig()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.remove.html">rs.remove()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.slaveOk.html">rs.slaveOk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.status.html">rs.status()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.stepDown.html">rs.stepDown()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.syncFrom.html">rs.syncFrom()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-sharding.html">Sharding Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addShard.html">sh.addShard()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addShardTag.html">sh.addShardTag()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addShardToZone.html">sh.addShardToZone()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addTagRange.html">sh.addTagRange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.disableBalancing.html">sh.disableBalancing()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.enableBalancing.html">sh.enableBalancing()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.disableAutoSplit.html">sh.disableAutoSplit</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.enableAutoSplit.html">sh.enableAutoSplit</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.enableSharding.html">sh.enableSharding()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.getBalancerHost.html">sh.getBalancerHost()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.getBalancerState.html">sh.getBalancerState()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeTagRange.html">sh.removeTagRange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeRangeFromZone.html">sh.removeRangeFromZone()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.help.html">sh.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.isBalancerRunning.html">sh.isBalancerRunning()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.moveChunk.html">sh.moveChunk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeShardTag.html">sh.removeShardTag()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeShardFromZone.html">sh.removeShardFromZone()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.setBalancerState.html">sh.setBalancerState()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.shardCollection.html">sh.shardCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.splitAt.html">sh.splitAt()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.splitFind.html">sh.splitFind()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.startBalancer.html">sh.startBalancer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.status.html">sh.status()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.stopBalancer.html">sh.stopBalancer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.waitForBalancer.html">sh.waitForBalancer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.waitForBalancerOff.html">sh.waitForBalancerOff()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.waitForPingChange.html">sh.waitForPingChange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.updateZoneKeyRange.html">sh.updateZoneKeyRange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/convertShardKeyToHashed.html">convertShardKeyToHashed</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-free-monitoring.html">Free Monitoring Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.disableFreeMonitoring.html">db.disableFreeMonitoring()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.enableFreeMonitoring.html">db.enableFreeMonitoring()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getFreeMonitoringStatus.html">db.getFreeMonitoringStatus</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-constructor.html">Object Constructors and Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/BulkWriteResult.html">BulkWriteResult()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Date.html">Date()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.html">ObjectId</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.getTimestamp.html">ObjectId.getTimestamp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.toString.html">ObjectId.toString()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.valueOf.html">ObjectId.valueOf()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/UUID.html">UUID()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/WriteResult.html">WriteResult()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/WriteResult.hasWriteError.html">WriteResult.hasWriteError()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/WriteResult.hasWriteConcernError.html">WriteResult.hasWriteConcernError()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-connection.html">Connection Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/connect.html">connect()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.html">Mongo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.getDB.html">Mongo.getDB()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.getReadPrefMode.html">Mongo.getReadPrefMode()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.getReadPrefTagSet.html">Mongo.getReadPrefTagSet()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.isCausalConsistency.html">Mongo.isCausalConsistency()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.setCausalConsistency.html">Mongo.setCausalConsistency()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.setReadPref.html">Mongo.setReadPref()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.setSlaveOk.html">Mongo.setSlaveOk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.startSession.html">Mongo.startSession()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.watch.html">Mongo.watch()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Session.html">Session</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/method/Session.abortTransaction.html">Session.abortTransaction()</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/method/Session.commitTransaction.html">Session.commitTransaction()</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/method/Session.startTransaction.html">Session.startTransaction()</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/SessionOptions.html">SessionOptions</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-native.html">Native Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/cat.html">cat()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cd.html">cd()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/copyDbpath.html">copyDbpath()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/getHostName.html">getHostName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/getMemInfo.html">getMemInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/hostname.html">hostname()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/isInteractive.html">isInteractive()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/listFiles.html">listFiles()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/load.html">load()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ls.html">ls()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/md5sumFile.html">md5sumFile()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/mkdir.html">mkdir()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/pwd.html">pwd()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/quit.html">quit()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/removeFile.html">removeFile()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/resetDbpath.html">resetDbpath()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sleep.html">sleep()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/setVerboseShell.html">setVerboseShell()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/version.html">version()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/isWindows.html">_isWindows()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rand.html">_rand()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-client-side-field-level-encryption.html">Client-Side Field Level Encryption Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/getKeyVault.html">getKeyVault()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.createKey.html">KeyVault.createKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.deleteKey.html">KeyVault.deleteKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.getKey.html">KeyVault.getKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.getKeys.html">KeyVault.getKeys()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.addKeyAlternateName.html">KeyVault.addKeyAlternateName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.removeKeyAlternateName.html">KeyVault.removeKeyAlternateName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.getKeyByAltName.html">KeyVault.getKeyByAltName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/getClientEncryption.html">getClientEncryption()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ClientEncryption.encrypt.html">ClientEncryption.encrypt()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ClientEncryption.decrypt.html">ClientEncryption.decrypt()</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/program.html">MongoDB Package Components</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongod.html"><code class="docutils literal"><span class="pre">mongod</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongos.html"><code class="docutils literal"><span class="pre">mongos</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongo.html"><code class="docutils literal"><span class="pre">mongo</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongod.exe.html"><code class="docutils literal"><span class="pre">mongod.exe</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongos.exe.html"><code class="docutils literal"><span class="pre">mongos.exe</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongodump.html"><code class="docutils literal"><span class="pre">mongodump</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongorestore.html"><code class="docutils literal"><span class="pre">mongorestore</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/bsondump.html"><code class="docutils literal"><span class="pre">bsondump</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoimport.html"><code class="docutils literal"><span class="pre">mongoimport</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoexport.html"><code class="docutils literal"><span class="pre">mongoexport</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongostat.html"><code class="docutils literal"><span class="pre">mongostat</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongotop.html"><code class="docutils literal"><span class="pre">mongotop</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoreplay.html"><code class="docutils literal"><span class="pre">mongoreplay</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoldap.html"><code class="docutils literal"><span class="pre">mongoldap</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongofiles.html"><code class="docutils literal"><span class="pre">mongofiles</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/install_compass.html"><code class="docutils literal"><span class="pre">install_compass</span></code></a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/configuration-options.html">Configuration File Options</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/expansion-directives.html">Externally Sourced Configuration File Values</a></li><li class="toctree-l3"><a class="reference internal" href="convert-command-line-options-to-yaml.html">Convert Command-Line Options to YAML</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/configuration-file-settings-command-line-options-mapping.html">Configuration File Settings and Command-Line Options Mapping</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/parameters.html">MongoDB Server Parameters</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/limits.html">MongoDB Limits and Thresholds</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/explain-results.html">Explain Results</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/system-collections.html">System Collections</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/connection-string.html">Connection String URI Format</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/collation.html">Collation</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/collation-locales-defaults.html">Collation Locales and Default Parameters</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/mongodb-wire-protocol.html">MongoDB Wire Protocol</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/log-messages.html">Log Messages</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/exit-codes.html">Exit Codes and Statuses</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/glossary.html">Glossary</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/default-mongodb-port.html">Default MongoDB Port</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/server-sessions.html">Server Sessions</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../release-notes.html">Release Notes</a><ul><li class="toctree-l2"><a class="reference internal" href="../release-notes/4.2.html">Release Notes for MongoDB 4.2</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-compatibility.html">Compatibility Changes in MongoDB 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-upgrade-standalone.html">Upgrade a Standalone to 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-upgrade-replica-set.html">Upgrade a Replica Set to 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-downgrade.html">Downgrade 4.2 to 4.0</a><ul><li class="toctree-l4"><a class="reference internal" href="../release-notes/4.2-downgrade-standalone.html">Downgrade 4.2 Standalone to 4.0</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/4.2-downgrade-replica-set.html">Downgrade 4.2 Replica Set to 4.0</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/4.2-downgrade-sharded-cluster.html">Downgrade 4.2 Sharded Cluster to 4.0</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-changelog.html">4.2 Changelog</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/4.0.html">Release Notes for MongoDB 4.0</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-compatibility.html">Compatibility Changes in MongoDB 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-upgrade-standalone.html">Upgrade a Standalone to 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-upgrade-replica-set.html">Upgrade a Replica Set to 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-downgrade-standalone.html">Downgrade 4.0 Standalone to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-downgrade-replica-set.html">Downgrade 4.0 Replica Set to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-downgrade-sharded-cluster.html">Downgrade 4.0 Sharded Cluster to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-changelog.html">4.0 Changelog</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.6.html">Release Notes for MongoDB 3.6</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-changelog.html">3.6 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-compatibility.html">Compatibility Changes in MongoDB 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-upgrade-standalone.html">Upgrade a Standalone to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-upgrade-replica-set.html">Upgrade a Replica Set to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-downgrade-standalone.html">Downgrade 3.6 Standalone to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-downgrade-replica-set.html">Downgrade 3.6 Replica Set to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-downgrade-sharded-cluster.html">Downgrade 3.6 Sharded Cluster to 3.4</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.4.html">Release Notes for MongoDB 3.4</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-changelog.html">3.4 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-compatibility.html">Compatibility Changes in MongoDB 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-upgrade-standalone.html">Upgrade a Standalone to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-upgrade-replica-set.html">Upgrade a Replica Set to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-downgrade.html">Downgrade MongoDB 3.4 to 3.2</a><ul><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.4-downgrade-standalone.html">Downgrade 3.4 Standalone to 3.2</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.4-downgrade-replica-set.html">Downgrade 3.4 Replica Set to 3.2</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.4-downgrade-sharded-cluster.html">Downgrade 3.4 Sharded Cluster to 3.2</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.2.html">Release Notes for MongoDB 3.2</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-changelog.html">3.2 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-compatibility.html">Compatibility Changes in MongoDB 3.2</a><ul><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.2-javascript.html">JavaScript Changes in MongoDB 3.2</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-upgrade.html">Upgrade MongoDB to 3.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-downgrade.html">Downgrade MongoDB from 3.2</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.0.html">Release Notes for MongoDB 3.0</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-changelog.html">3.0 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-compatibility.html">Compatibility Changes in MongoDB 3.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-upgrade.html">Upgrade MongoDB to 3.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-scram.html">Upgrade to SCRAM</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-downgrade.html">Downgrade MongoDB from 3.0</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.6.html">Release Notes for MongoDB 2.6</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-changelog.html">2.6 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-compatibility.html">Compatibility Changes in MongoDB 2.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-upgrade.html">Upgrade MongoDB to 2.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-upgrade-authorization.html">Upgrade User Authorization Data to 2.6 Format</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-downgrade.html">Downgrade MongoDB from 2.6</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.4.html">Release Notes for MongoDB 2.4</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-changelog.html">2.4 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-javascript.html">JavaScript Changes in MongoDB 2.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-upgrade.html">Upgrade MongoDB to 2.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-index-types.html">Compatibility and Index Type Changes in MongoDB 2.4</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.2.html">Release Notes for MongoDB 2.2</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.0.html">Release Notes for MongoDB 2.0</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.8.html">Release Notes for MongoDB 1.8</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.6.html">Release Notes for MongoDB 1.6</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.4.html">Release Notes for MongoDB 1.4</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.2.html">Release Notes for MongoDB 1.2.x</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/versioning.html">MongoDB Versioning</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../support.html">Technical Support</a></li></ul>


    </div>
  </div>
           
         </aside>

   </div>

    <div id="main-column" class="main-column">

    <span id="showNav" class="showNav">Navigation</span>

      
        <div class="document">
            <div class="documentwrapper"><div class="bodywrapper">
              <div class="body" data-pagename="tutorial/query-documents">
                   <a class="edit-link" href="https://github.com/mongodb/docs/blob/v4.2/source/tutorial/query-documents.txt" target="_blank" title="Edit tutorial/query-documents.txt on GitHub">
    
      <span class="icon-edit"></span>
    
  </a>
                

                
  <div class="bc">
    
      <ul>
          <li><a href="../crud.html">MongoDB CRUD Operations</a><span class="bcpoint"> > </span></li>
            <li>Query Documents</li> 
      </ul>
    
    
  </div>
                
                  <div class="section" id="query-documents">
<span id="read-operations-queries"></span><span id="read-operations-query-document"></span><h1>Query Documents<a class="headerlink" href="#query-documents" title="Permalink to this headline">¶</a></h1>
<p>This page provides examples in:</p>
<ul class="guide__pills pillstrip-declaration" role="tablist" data-tab-preference="languages"></ul><div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><p>This page provides examples of query operations using the
<a class="reference internal" href="../reference/method/db.collection.find.html#db.collection.find" title="db.collection.find()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.find()</span></code></a> method in the
<a class="reference internal" href="../reference/program/mongo.html#bin.mongo" title="bin.mongo"><code class="xref mongodb mongodb-binary docutils literal"><span class="pre">mongo</span></code></a> shell. The examples on this page use the
<code class="docutils literal"><span class="pre">inventory</span></code> collection. To populate the <code class="docutils literal"><span class="pre">inventory</span></code>
collection, run the following:</p>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>This page provides examples of query operations using
<a class="reference external" href="https://docs.mongodb.com/compass/current/#compass-index" title="(in compass vmaster)"><span class="xref std std-ref">MongoDB Compass</span></a>. The examples on this
page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. Populate the
<code class="docutils literal"><span class="pre">inventory</span></code> collection with the following documents:</p>
</div>
<div class="tabpanel-python" data-tabid="python"><p>This page provides examples of query operations using the
<a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">pymongo.collection.Collection.find()</span></code></a> method in the
<a class="reference external" href="https://api.mongodb.com/python/current/index.html">PyMongo</a>
Python driver. The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code>
collection. To populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the
following:</p>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><p>This page provides examples of query operations using the
<a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/MongoCollection.html#find--">com.mongodb.client.MongoCollection.find</a> method in the MongoDB
<a class="reference external" href="http://mongodb.github.io/mongo-java-driver/3.4/driver/">Java Synchronous Driver</a>.</p>
<div class="admonition-tip admonition">
<p class="first admonition-title">Tip</p>
<p class="last">The driver provides <a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/model/Filters.html">com.mongodb.client.model.Filters</a>
helper methods to facilitate the creation of filter
documents. The examples on this page use these methods to
create the filter documents.</p>
</div>
<p>The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code>
collection. To populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the
following:</p>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><p>This page provides examples of query operations using the
<a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#find">Collection.find()</a> method in
the <a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/">MongoDB Node.js Driver</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
</div>
<div class="tabpanel-php" data-tabid="php"><p>This page provides examples of query operations using the
<a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-find/#phpmethod.MongoDB\Collection::find" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">MongoDB\Collection::find()</span></code></a>
method in the
<a class="reference external" href="https://docs.mongodb.com/php-library/master/">MongoDB PHP Library</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
</div>
<div class="tabpanel-motor" data-tabid="motor"><p>This page provides examples of query operations using the
<a class="reference external" href="https://motor.readthedocs.io/en/stable/api-asyncio/asyncio_motor_collection.html#motor.motor_asyncio.AsyncIOMotorCollection.find" title="(in Motor v2.1.0)"><code class="xref py py-meth docutils literal"><span class="pre">motor.motor_asyncio.AsyncIOMotorCollection.find()</span></code></a>
method in the <a class="reference external" href="https://motor.readthedocs.io/en/stable/">Motor</a>
driver. The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code>
collection. To populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the
following:</p>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><p>This page provides examples of query operations using the
<a class="reference external" href="http://mongodb.github.io/mongo-java-driver-reactivestreams/1.6/javadoc/com/mongodb/reactivestreams/client/MongoCollection.html#find()">com.mongodb.reactivestreams.client.MongoCollection.find</a>
method in the MongoDB <a class="reference external" href="http://mongodb.github.io/mongo-java-driver-reactivestreams/1.6/">Java Reactive Streams Driver</a>.</p>
<p>The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code>
collection. To populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the
following:</p>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><p>This page provides examples of query operations using the
<a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_Find.htm">MongoCollection.Find()</a>
method in the
<a class="reference external" href="https://mongodb.github.io/mongo-csharp-driver/">MongoDB C# Driver</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
</div>
<div class="tabpanel-perl" data-tabid="perl"><p>This page provides examples of query operations using the
<a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find">MongoDB::Collection::find()</a> method
in the
<a class="reference external" href="https://metacpan.org/release/MongoDB">MongoDB Perl Driver</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><p>This page provides examples of query operations using the
<a class="reference external" href="https://api.mongodb.com/ruby/current/Mongo/Collection.html#find-instance_method">Mongo::Collection#find()</a>
method in the
<a class="reference external" href="https://docs.mongodb.com/ruby-driver/master/">MongoDB Ruby Driver</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
</div>
<div class="tabpanel-scala" data-tabid="scala"><p>This page provides examples of query operations using the
<a class="reference external" href="https://mongodb.github.io/mongo-scala-driver/2.0/scaladoc/org/mongodb/scala/MongoCollection.html#find[C](filter:org.mongodb.scala.bson.conversions.Bson)(implicite:org.mongodb.scala.bson.DefaultHelper.DefaultsTo[C,TResult],implicitct:scala.reflect.ClassTag[C]):org.mongodb.scala.FindObservable[C]">collection.find()</a> method
in the
<a class="reference external" href="http://mongodb.github.io/mongo-scala-driver/">MongoDB Scala Driver</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
</div>
<div class="tabpanel-go" data-tabid="go"><p>This page provides examples of query operations using the
<a class="reference external" href="https://godoc.org/github.com/mongodb/mongo-go-driver/mongo#Collection.Find">Collection.Find</a>
function in the
<a class="reference external" href="https://github.com/mongodb/mongo-go-driver/">MongoDB Go Driver</a>.
The examples on this page use the <code class="docutils literal"><span class="pre">inventory</span></code> collection. To
populate the <code class="docutils literal"><span class="pre">inventory</span></code> collection, run the following:</p>
    </div>
  </div>
</div><div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">insertMany</span><span class="p">([</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;journal&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">25</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mi">14</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">21</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;cm&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;notebook&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">50</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;in&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;paper&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">100</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;in&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;D&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;planner&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">75</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">22.85</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">30</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;cm&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;D&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;postcard&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">45</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mi">10</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mf">15.25</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;cm&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">}</span>
<span class="p">]);</span>
</pre></div>
</div>
</div>
<p>You can run the operation in the web shell below:</p>
<iframe class="mws-root" allowfullscreen sandbox="allow-scripts allow-same-origin" width=100% height=320 src="https://mws.mongodb.com/?version=4.2"></iframe></div>
<div class="tabpanel-compass" data-tabid="compass"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">[</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;journal&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">25</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mi">14</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">21</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;cm&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;notebook&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">50</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;in&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;paper&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">100</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;in&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;D&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;planner&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">75</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">22.85</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">30</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;cm&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;D&quot;</span> <span class="p">},</span>
   <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="s2">&quot;postcard&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="mi">45</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mi">10</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mf">15.25</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s2">&quot;cm&quot;</span> <span class="p">},</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">}</span>
<span class="p">]</span>
</pre></div>
</div>
</div>
<p>For instructions on inserting documents in MongoDB Compass, see
<a class="reference internal" href="insert-documents.html"><span class="doc">Insert Documents</span></a>.</p>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">insert_many</span><span class="p">([</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;journal&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">25</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mi">14</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">21</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;cm&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;notebook&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">50</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;in&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;paper&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">100</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;in&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;D&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;planner&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">75</span><span class="p">,</span> <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mf">22.85</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;cm&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;D&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;postcard&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">45</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mf">15.25</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;cm&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">}])</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">collection</span><span class="o">.</span><span class="na">insertMany</span><span class="o">(</span><span class="n">asList</span><span class="o">(</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;journal&#39;, qty: 25, size: { h: 14, w: 21, uom: &#39;cm&#39; }, status: &#39;A&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;notebook&#39;, qty: 50, size: { h: 8.5, w: 11, uom: &#39;in&#39; }, status: &#39;A&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;paper&#39;, qty: 100, size: { h: 8.5, w: 11, uom: &#39;in&#39; }, status: &#39;D&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;planner&#39;, qty: 75, size: { h: 22.85, w: 30, uom: &#39;cm&#39; }, status: &#39;D&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;postcard&#39;, qty: 45, size: { h: 10, w: 15.25, uom: &#39;cm&#39; }, status: &#39;A&#39; }&quot;</span><span class="o">)</span>
<span class="o">));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">await</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">insertMany</span><span class="p">([</span>
  <span class="p">{</span>
    <span class="nx">item</span><span class="o">:</span> <span class="s1">&#39;journal&#39;</span><span class="p">,</span>
    <span class="nx">qty</span><span class="o">:</span> <span class="mi">25</span><span class="p">,</span>
    <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mi">14</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">21</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s1">&#39;cm&#39;</span> <span class="p">},</span>
    <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;A&#39;</span>
  <span class="p">},</span>
  <span class="p">{</span>
    <span class="nx">item</span><span class="o">:</span> <span class="s1">&#39;notebook&#39;</span><span class="p">,</span>
    <span class="nx">qty</span><span class="o">:</span> <span class="mi">50</span><span class="p">,</span>
    <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s1">&#39;in&#39;</span> <span class="p">},</span>
    <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;A&#39;</span>
  <span class="p">},</span>
  <span class="p">{</span>
    <span class="nx">item</span><span class="o">:</span> <span class="s1">&#39;paper&#39;</span><span class="p">,</span>
    <span class="nx">qty</span><span class="o">:</span> <span class="mi">100</span><span class="p">,</span>
    <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s1">&#39;in&#39;</span> <span class="p">},</span>
    <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;D&#39;</span>
  <span class="p">},</span>
  <span class="p">{</span>
    <span class="nx">item</span><span class="o">:</span> <span class="s1">&#39;planner&#39;</span><span class="p">,</span>
    <span class="nx">qty</span><span class="o">:</span> <span class="mi">75</span><span class="p">,</span>
    <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mf">22.85</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mi">30</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s1">&#39;cm&#39;</span> <span class="p">},</span>
    <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;D&#39;</span>
  <span class="p">},</span>
  <span class="p">{</span>
    <span class="nx">item</span><span class="o">:</span> <span class="s1">&#39;postcard&#39;</span><span class="p">,</span>
    <span class="nx">qty</span><span class="o">:</span> <span class="mi">45</span><span class="p">,</span>
    <span class="nx">size</span><span class="o">:</span> <span class="p">{</span> <span class="nx">h</span><span class="o">:</span> <span class="mi">10</span><span class="p">,</span> <span class="nx">w</span><span class="o">:</span> <span class="mf">15.25</span><span class="p">,</span> <span class="nx">uom</span><span class="o">:</span> <span class="s1">&#39;cm&#39;</span> <span class="p">},</span>
    <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;A&#39;</span>
  <span class="p">}</span>
<span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$insertManyResult</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">insertMany</span><span class="p">([</span>
    <span class="p">[</span>
        <span class="s1">&#39;item&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;journal&#39;</span><span class="p">,</span>
        <span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="mi">25</span><span class="p">,</span>
        <span class="s1">&#39;size&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;h&#39;</span> <span class="o">=&gt;</span> <span class="mi">14</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span> <span class="o">=&gt;</span> <span class="mi">21</span><span class="p">,</span> <span class="s1">&#39;uom&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;cm&#39;</span><span class="p">],</span>
        <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
    <span class="p">],</span>
    <span class="p">[</span>
        <span class="s1">&#39;item&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;notebook&#39;</span><span class="p">,</span>
        <span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="mi">50</span><span class="p">,</span>
        <span class="s1">&#39;size&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;h&#39;</span> <span class="o">=&gt;</span> <span class="mf">8.5</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span> <span class="o">=&gt;</span> <span class="mi">11</span><span class="p">,</span> <span class="s1">&#39;uom&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;in&#39;</span><span class="p">],</span>
        <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
    <span class="p">],</span>
    <span class="p">[</span>
        <span class="s1">&#39;item&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;paper&#39;</span><span class="p">,</span>
        <span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="mi">100</span><span class="p">,</span>
        <span class="s1">&#39;size&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;h&#39;</span> <span class="o">=&gt;</span> <span class="mf">8.5</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span> <span class="o">=&gt;</span> <span class="mi">11</span><span class="p">,</span> <span class="s1">&#39;uom&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;in&#39;</span><span class="p">],</span>
        <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;D&#39;</span><span class="p">,</span>
    <span class="p">],</span>
    <span class="p">[</span>
        <span class="s1">&#39;item&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;planner&#39;</span><span class="p">,</span>
        <span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="mi">75</span><span class="p">,</span>
        <span class="s1">&#39;size&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;h&#39;</span> <span class="o">=&gt;</span> <span class="mf">22.85</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span><span class="p">,</span> <span class="s1">&#39;uom&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;cm&#39;</span><span class="p">],</span>
        <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;D&#39;</span><span class="p">,</span>
    <span class="p">],</span>
    <span class="p">[</span>
        <span class="s1">&#39;item&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;postcard&#39;</span><span class="p">,</span>
        <span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="mi">45</span><span class="p">,</span>
        <span class="s1">&#39;size&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;h&#39;</span> <span class="o">=&gt;</span> <span class="mi">10</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span> <span class="o">=&gt;</span> <span class="mf">15.25</span><span class="p">,</span> <span class="s1">&#39;uom&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;cm&#39;</span><span class="p">],</span>
        <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
    <span class="p">],</span>
<span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">await</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">insert_many</span><span class="p">([</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;journal&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">25</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mi">14</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">21</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;cm&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;notebook&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">50</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;in&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;paper&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">100</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mf">8.5</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;in&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;D&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;planner&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">75</span><span class="p">,</span> <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mf">22.85</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;cm&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;D&quot;</span><span class="p">},</span>
    <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="s2">&quot;postcard&quot;</span><span class="p">,</span>
     <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="mi">45</span><span class="p">,</span>
     <span class="s2">&quot;size&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;h&quot;</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">:</span> <span class="mf">15.25</span><span class="p">,</span> <span class="s2">&quot;uom&quot;</span><span class="p">:</span> <span class="s2">&quot;cm&quot;</span><span class="p">},</span>
     <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">}])</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">Publisher</span><span class="o">&lt;</span><span class="n">Success</span><span class="o">&gt;</span> <span class="n">insertManyPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">insertMany</span><span class="o">(</span><span class="n">asList</span><span class="o">(</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;journal&#39;, qty: 25, size: { h: 14, w: 21, uom: &#39;cm&#39; }, status: &#39;A&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;notebook&#39;, qty: 50, size: { h: 8.5, w: 11, uom: &#39;in&#39; }, status: &#39;A&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;paper&#39;, qty: 100, size: { h: 8.5, w: 11, uom: &#39;in&#39; }, status: &#39;D&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;planner&#39;, qty: 75, size: { h: 22.85, w: 30, uom: &#39;cm&#39; }, status: &#39;D&#39; }&quot;</span><span class="o">),</span>
        <span class="n">Document</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;{ item: &#39;postcard&#39;, qty: 45, size: { h: 10, w: 15.25, uom: &#39;cm&#39; }, status: &#39;A&#39; }&quot;</span><span class="o">)</span>
<span class="o">));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">documents</span> <span class="p">=</span> <span class="k">new</span> <span class="n">BsonDocument</span><span class="p">[]</span>
<span class="p">{</span>
    <span class="k">new</span> <span class="n">BsonDocument</span>
    <span class="p">{</span>
        <span class="p">{</span> <span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;journal&quot;</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">25</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">BsonDocument</span> <span class="p">{</span> <span class="p">{</span> <span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="m">14</span> <span class="p">},</span> <span class="p">{</span> <span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="m">21</span> <span class="p">},</span> <span class="p">{</span>  <span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;cm&quot;</span><span class="p">}</span> <span class="p">}</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span> <span class="p">}</span>
    <span class="p">},</span>
    <span class="k">new</span> <span class="n">BsonDocument</span>
    <span class="p">{</span>
        <span class="p">{</span> <span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;notebook&quot;</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">50</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">BsonDocument</span> <span class="p">{</span> <span class="p">{</span> <span class="s">&quot;h&quot;</span><span class="p">,</span>  <span class="m">8.5</span> <span class="p">},</span> <span class="p">{</span> <span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="m">11</span> <span class="p">},</span> <span class="p">{</span>  <span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;in&quot;</span><span class="p">}</span> <span class="p">}</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span> <span class="p">}</span>
    <span class="p">},</span>
    <span class="k">new</span> <span class="n">BsonDocument</span>
    <span class="p">{</span>
        <span class="p">{</span> <span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;paper&quot;</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">100</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">BsonDocument</span> <span class="p">{</span> <span class="p">{</span> <span class="s">&quot;h&quot;</span><span class="p">,</span>  <span class="m">8.5</span> <span class="p">},</span> <span class="p">{</span> <span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="m">11</span> <span class="p">},</span> <span class="p">{</span>  <span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;in&quot;</span><span class="p">}</span> <span class="p">}</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span> <span class="p">}</span>
    <span class="p">},</span>
    <span class="k">new</span> <span class="n">BsonDocument</span>
    <span class="p">{</span>
        <span class="p">{</span> <span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;planner&quot;</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">75</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">BsonDocument</span> <span class="p">{</span> <span class="p">{</span> <span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="m">22.85</span> <span class="p">},</span> <span class="p">{</span> <span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="m">30</span>  <span class="p">},</span> <span class="p">{</span>  <span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;cm&quot;</span><span class="p">}</span> <span class="p">}</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span> <span class="p">}</span>
    <span class="p">},</span>
    <span class="k">new</span> <span class="n">BsonDocument</span>
    <span class="p">{</span>
        <span class="p">{</span> <span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;postcard&quot;</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">45</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">BsonDocument</span> <span class="p">{</span> <span class="p">{</span> <span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="m">10</span> <span class="p">},</span> <span class="p">{</span> <span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="m">15.25</span> <span class="p">},</span> <span class="p">{</span>  <span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;cm&quot;</span><span class="p">}</span> <span class="p">}</span> <span class="p">},</span>
        <span class="p">{</span> <span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span> <span class="p">}</span>
    <span class="p">},</span>
<span class="p">};</span>
<span class="n">collection</span><span class="p">.</span><span class="n">InsertMany</span><span class="p">(</span><span class="n">documents</span><span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">insert_many</span><span class="p">(</span>
    <span class="p">[</span>
        <span class="p">{</span>
            <span class="n">item</span>   <span class="o">=&gt;</span> <span class="s">&quot;journal&quot;</span><span class="p">,</span>
            <span class="n">qty</span>    <span class="o">=&gt;</span> <span class="mi">25</span><span class="p">,</span>
            <span class="n">size</span>   <span class="o">=&gt;</span> <span class="p">{</span> <span class="n">h</span> <span class="o">=&gt;</span> <span class="mi">14</span><span class="p">,</span> <span class="n">w</span> <span class="o">=&gt;</span> <span class="mi">21</span><span class="p">,</span> <span class="n">uom</span> <span class="o">=&gt;</span> <span class="s">&quot;cm&quot;</span> <span class="p">},</span>
            <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;A&quot;</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="n">item</span>   <span class="o">=&gt;</span> <span class="s">&quot;notebook&quot;</span><span class="p">,</span>
            <span class="n">qty</span>    <span class="o">=&gt;</span> <span class="mi">50</span><span class="p">,</span>
            <span class="n">size</span>   <span class="o">=&gt;</span> <span class="p">{</span> <span class="n">h</span> <span class="o">=&gt;</span> <span class="mf">8.5</span><span class="p">,</span> <span class="n">w</span> <span class="o">=&gt;</span> <span class="mi">11</span><span class="p">,</span> <span class="n">uom</span> <span class="o">=&gt;</span> <span class="s">&quot;in&quot;</span> <span class="p">},</span>
            <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;A&quot;</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="n">item</span>   <span class="o">=&gt;</span> <span class="s">&quot;paper&quot;</span><span class="p">,</span>
            <span class="n">qty</span>    <span class="o">=&gt;</span> <span class="mi">100</span><span class="p">,</span>
            <span class="n">size</span>   <span class="o">=&gt;</span> <span class="p">{</span> <span class="n">h</span> <span class="o">=&gt;</span> <span class="mf">8.5</span><span class="p">,</span> <span class="n">w</span> <span class="o">=&gt;</span> <span class="mi">11</span><span class="p">,</span> <span class="n">uom</span> <span class="o">=&gt;</span> <span class="s">&quot;in&quot;</span> <span class="p">},</span>
            <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;D&quot;</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="n">item</span>   <span class="o">=&gt;</span> <span class="s">&quot;planner&quot;</span><span class="p">,</span>
            <span class="n">qty</span>    <span class="o">=&gt;</span> <span class="mi">75</span><span class="p">,</span>
            <span class="n">size</span>   <span class="o">=&gt;</span> <span class="p">{</span> <span class="n">h</span> <span class="o">=&gt;</span> <span class="mf">22.85</span><span class="p">,</span> <span class="n">w</span> <span class="o">=&gt;</span> <span class="mi">30</span><span class="p">,</span> <span class="n">uom</span> <span class="o">=&gt;</span> <span class="s">&quot;cm&quot;</span> <span class="p">},</span>
            <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;D&quot;</span>
        <span class="p">},</span>
        <span class="p">{</span>
            <span class="n">item</span>   <span class="o">=&gt;</span> <span class="s">&quot;postcard&quot;</span><span class="p">,</span>
            <span class="n">qty</span>    <span class="o">=&gt;</span> <span class="mi">45</span><span class="p">,</span>
            <span class="n">size</span>   <span class="o">=&gt;</span> <span class="p">{</span> <span class="n">h</span> <span class="o">=&gt;</span> <span class="mi">10</span><span class="p">,</span> <span class="n">w</span> <span class="o">=&gt;</span> <span class="mf">15.25</span><span class="p">,</span> <span class="n">uom</span> <span class="o">=&gt;</span> <span class="s">&quot;cm&quot;</span> <span class="p">},</span>
            <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;A&quot;</span>
        <span class="p">}</span>
    <span class="p">]</span>
<span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">insert_many</span><span class="p">(</span><span class="o">[</span><span class="p">{</span> <span class="ss">item</span><span class="p">:</span> <span class="s1">&#39;journal&#39;</span><span class="p">,</span>
                                  <span class="ss">qty</span><span class="p">:</span> <span class="mi">25</span><span class="p">,</span>
                                  <span class="ss">size</span><span class="p">:</span> <span class="p">{</span> <span class="ss">h</span><span class="p">:</span> <span class="mi">14</span><span class="p">,</span> <span class="ss">w</span><span class="p">:</span> <span class="mi">21</span><span class="p">,</span> <span class="ss">uom</span><span class="p">:</span> <span class="s1">&#39;cm&#39;</span> <span class="p">},</span>
                                  <span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;A&#39;</span> <span class="p">},</span>
                                <span class="p">{</span> <span class="ss">item</span><span class="p">:</span> <span class="s1">&#39;notebook&#39;</span><span class="p">,</span>
                                  <span class="ss">qty</span><span class="p">:</span> <span class="mi">50</span><span class="p">,</span>
                                  <span class="ss">size</span><span class="p">:</span> <span class="p">{</span> <span class="ss">h</span><span class="p">:</span> <span class="mi">8</span><span class="o">.</span><span class="mi">5</span><span class="p">,</span> <span class="ss">w</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span> <span class="ss">uom</span><span class="p">:</span> <span class="s1">&#39;in&#39;</span> <span class="p">},</span>
                                  <span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;A&#39;</span> <span class="p">},</span>
                                <span class="p">{</span> <span class="ss">item</span><span class="p">:</span> <span class="s1">&#39;paper&#39;</span><span class="p">,</span>
                                  <span class="ss">qty</span><span class="p">:</span> <span class="mi">100</span><span class="p">,</span>
                                  <span class="ss">size</span><span class="p">:</span> <span class="p">{</span> <span class="ss">h</span><span class="p">:</span> <span class="mi">8</span><span class="o">.</span><span class="mi">5</span><span class="p">,</span> <span class="ss">w</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span> <span class="ss">uom</span><span class="p">:</span> <span class="s1">&#39;in&#39;</span> <span class="p">},</span>
                                  <span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;D&#39;</span> <span class="p">},</span>
                                <span class="p">{</span> <span class="ss">item</span><span class="p">:</span> <span class="s1">&#39;planner&#39;</span><span class="p">,</span>
                                  <span class="ss">qty</span><span class="p">:</span> <span class="mi">75</span><span class="p">,</span>
                                  <span class="ss">size</span><span class="p">:</span> <span class="p">{</span> <span class="ss">h</span><span class="p">:</span> <span class="mi">22</span><span class="o">.</span><span class="mi">85</span><span class="p">,</span> <span class="ss">w</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="ss">uom</span><span class="p">:</span> <span class="s1">&#39;cm&#39;</span> <span class="p">},</span>
                                  <span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;D&#39;</span> <span class="p">},</span>
                                <span class="p">{</span> <span class="ss">item</span><span class="p">:</span> <span class="s1">&#39;postcard&#39;</span><span class="p">,</span>
                                  <span class="ss">qty</span><span class="p">:</span> <span class="mi">45</span><span class="p">,</span>
                                  <span class="ss">size</span><span class="p">:</span> <span class="p">{</span> <span class="ss">h</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span> <span class="ss">w</span><span class="p">:</span> <span class="mi">15</span><span class="o">.</span><span class="mi">25</span><span class="p">,</span> <span class="ss">uom</span><span class="p">:</span> <span class="s1">&#39;cm&#39;</span> <span class="p">},</span>
                                  <span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;A&#39;</span> <span class="p">}</span>
                               <span class="o">]</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">collection</span><span class="o">.</span><span class="n">insertMany</span><span class="o">(</span><span class="nc">Seq</span><span class="o">(</span>
  <span class="nc">Document</span><span class="o">(</span><span class="s">&quot;&quot;&quot;{ item: &quot;journal&quot;, qty: 25, size: { h: 14, w: 21, uom: &quot;cm&quot; }, status: &quot;A&quot; }&quot;&quot;&quot;</span><span class="o">),</span>
  <span class="nc">Document</span><span class="o">(</span><span class="s">&quot;&quot;&quot;{ item: &quot;notebook&quot;, qty: 50, size: { h: 8.5, w: 11, uom: &quot;in&quot; }, status: &quot;A&quot; }&quot;&quot;&quot;</span><span class="o">),</span>
  <span class="nc">Document</span><span class="o">(</span><span class="s">&quot;&quot;&quot;{ item: &quot;paper&quot;, qty: 100, size: { h: 8.5, w: 11, uom: &quot;in&quot; }, status: &quot;D&quot; }&quot;&quot;&quot;</span><span class="o">),</span>
  <span class="nc">Document</span><span class="o">(</span><span class="s">&quot;&quot;&quot;{ item: &quot;planner&quot;, qty: 75, size: { h: 22.85, w: 30, uom: &quot;cm&quot; }, status: &quot;D&quot; }&quot;&quot;&quot;</span><span class="o">),</span>
  <span class="nc">Document</span><span class="o">(</span><span class="s">&quot;&quot;&quot;{ item: &quot;postcard&quot;, qty: 45, size: { h: 10, w: 15.25, uom: &quot;cm&quot; }, status: &quot;A&quot; }&quot;&quot;&quot;</span><span class="o">)</span>
<span class="o">)).</span><span class="n">execute</span><span class="o">()</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">docs</span> <span class="o">:=</span> <span class="p">[]</span><span class="kd">interface</span><span class="p">{}{</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;journal&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="mi">25</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
			<span class="p">{</span><span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="mi">14</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="mi">21</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;cm&quot;</span><span class="p">},</span>
		<span class="p">}},</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">},</span>
	<span class="p">},</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;notebook&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="mi">50</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
			<span class="p">{</span><span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="mf">8.5</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="mi">11</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;in&quot;</span><span class="p">},</span>
		<span class="p">}},</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">},</span>
	<span class="p">},</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;paper&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="mi">100</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
			<span class="p">{</span><span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="mf">8.5</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="mi">11</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;in&quot;</span><span class="p">},</span>
		<span class="p">}},</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span><span class="p">},</span>
	<span class="p">},</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;planner&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="mi">75</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
			<span class="p">{</span><span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="mf">22.85</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="mi">30</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;cm&quot;</span><span class="p">},</span>
		<span class="p">}},</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span><span class="p">},</span>
	<span class="p">},</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="s">&quot;postcard&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="mi">45</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;size&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
			<span class="p">{</span><span class="s">&quot;h&quot;</span><span class="p">,</span> <span class="mi">10</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;w&quot;</span><span class="p">,</span> <span class="mf">15.25</span><span class="p">},</span>
			<span class="p">{</span><span class="s">&quot;uom&quot;</span><span class="p">,</span> <span class="s">&quot;cm&quot;</span><span class="p">},</span>
		<span class="p">}},</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">},</span>
	<span class="p">},</span>
<span class="p">}</span>

<span class="nx">result</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">InsertMany</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span> <span class="nx">docs</span><span class="p">)</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><div class="section" id="select-all-documents-in-a-collection">
<h2>Select All Documents in a Collection<a class="headerlink" href="#select-all-documents-in-a-collection" title="Permalink to this headline">¶</a></h2>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the
<a class="reference external" href="https://docs.mongodb.com/compass/current/query/filter/#compass-query-bar" title="(in compass vmaster)"><span class="xref std std-ref">query bar</span></a>. The
<a class="reference external" href="https://docs.mongodb.com/compass/current/query/filter/#query-bar-filter" title="(in compass vmaster)"><span class="xref std std-ref">query filter parameter</span></a> determines
the select criteria:</p>
</div>
<div class="tabpanel-python" data-tabid="python"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-php" data-tabid="php"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-motor" data-tabid="motor"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-perl" data-tabid="perl"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-scala" data-tabid="scala"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
</div>
<div class="tabpanel-go" data-tabid="go"><p>To select all documents in the collection, pass an empty
document as the query filter parameter to the find method. The
query filter parameter determines the select criteria:</p>
    </div>
  </div>
</div><div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{}</span> <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><div class="figure">
<img alt="../_images/compass-select-all.png" src="../_images/compass-select-all.png" />
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">FindIterable</span><span class="o">&lt;</span><span class="n">Document</span><span class="o">&gt;</span> <span class="n">findIterable</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="k">new</span> <span class="n">Document</span><span class="o">());</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="kr">const</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">find</span><span class="p">({});</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">([]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">FindPublisher</span><span class="o">&lt;</span><span class="n">Document</span><span class="o">&gt;</span> <span class="n">findPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="k">new</span> <span class="n">Document</span><span class="o">());</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">filter</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">.</span><span class="n">Empty</span><span class="p">;</span>
<span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="n">collection</span><span class="p">.</span><span class="n">Find</span><span class="p">(</span><span class="n">filter</span><span class="p">).</span><span class="n">ToList</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">find</span><span class="p">(</span> <span class="p">{}</span> <span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">find</span><span class="p">({})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="k">var</span> <span class="n">findObservable</span> <span class="k">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="o">(</span><span class="nc">Document</span><span class="o">())</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">Find</span><span class="p">(</span>
	<span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{},</span>
<span class="p">)</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>This operation corresponds to the following SQL statement:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-sql"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">inventory</span>
</pre></div>
</div>
</div>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><p>For more information on the syntax of the method, see
<a class="reference internal" href="../reference/method/db.collection.find.html#db.collection.find" title="db.collection.find()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">find()</span></code></a>.</p>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>For more information on the MongoDB Compass query bar, see
<a class="reference external" href="https://docs.mongodb.com/compass/current/query/filter/#compass-query-bar" title="(in compass vmaster)"><span class="xref std std-ref">Query Bar</span></a>.</p>
</div>
<div class="tabpanel-python" data-tabid="python"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">find()</span></code></a>.</p>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/MongoCollection.html#find--">com.mongodb.client.MongoCollection.find</a>.</p>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#find">find()</a>.</p>
</div>
<div class="tabpanel-php" data-tabid="php"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-find/#phpmethod.MongoDB\Collection::find" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">find()</span></code></a>.</p>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><p>For more information on the syntax of the method, see
<a class="reference external" href="http://mongodb.github.io/mongo-java-driver-reactivestreams/1.6/javadoc/com/mongodb/reactivestreams/client/MongoCollection.html#find()">com.mongodb.reactivestreams.client.MongoCollection.find</a>.</p>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_Find.htm">Find()</a>.</p>
</div>
<div class="tabpanel-perl" data-tabid="perl"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find">find()</a>.</p>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://api.mongodb.com/ruby/current/Mongo/Collection.html#find-instance_method">find()</a>.</p>
</div>
<div class="tabpanel-scala" data-tabid="scala"><p>For more information on the syntax of the method, see
<a class="reference external" href="https://mongodb.github.io/mongo-scala-driver/2.0/scaladoc/org/mongodb/scala/MongoCollection.html#find[C](filter:org.mongodb.scala.bson.conversions.Bson)(implicite:org.mongodb.scala.bson.DefaultHelper.DefaultsTo[C,TResult],implicitct:scala.reflect.ClassTag[C]):org.mongodb.scala.FindObservable[C]">collection.find()</a>.</p>
    </div>
  </div>
</div></div>
<div class="section" id="specify-equality-condition">
<span id="read-operations-query-argument"></span><h2>Specify Equality Condition<a class="headerlink" href="#specify-equality-condition" title="Permalink to this headline">¶</a></h2>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;:&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;:&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;:&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;</span><span class="p">:</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><p>To specify equality conditions, use the
<code class="docutils literal"><span class="pre">com.mongodb.client.model.Filters.eq_</span></code> method to create the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">and</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;),</span> <span class="n">eq</span><span class="o">(</span> <span class="o">&lt;</span><span class="n">field2</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value2</span><span class="o">&gt;)</span> <span class="o">...)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;:&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;</span> <span class="pre">=&gt;</span> <span class="pre">&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;</span> <span class="o">=&gt;</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">...</span> <span class="p">]</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;:&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;</span><span class="p">:</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><p>To specify equality conditions, use the
<a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/model/Filters.html#eq-java.lang.String-TItem-">com.mongodb.client.model.Filters.eq</a> method to create the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">and</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;),</span> <span class="n">eq</span><span class="o">(</span> <span class="o">&lt;</span><span class="n">field2</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value2</span><span class="o">&gt;)</span> <span class="o">...)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><p>To specify equality conditions, construct a filter using the
<a class="reference external" href="https://api.mongodb.com/csharp/current/html/Overload_MongoDB_Driver_FilterDefinitionBuilder_1_Eq.htm">Eq</a> method:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">.</span><span class="n">Eq</span><span class="p">(&lt;</span><span class="n">field</span><span class="p">&gt;,</span> <span class="p">&lt;</span><span class="k">value</span><span class="p">&gt;);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;</span> <span class="pre">=&gt;</span> <span class="pre">&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="sr">&lt;field1&gt;</span> <span class="o">=&gt;</span> <span class="sr">&lt;value1&gt;</span><span class="p">,</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><p>To specify equality conditions, use <code class="docutils literal"><span class="pre">&lt;field&gt;</span> <span class="pre">=&gt;</span> <span class="pre">&lt;value&gt;</span></code>
expressions in the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;</span> <span class="o">=&gt;</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><p>To specify equality conditions, use the
<code class="docutils literal"><span class="pre">com.mongodb.client.model.Filters.eq_</span></code> method to create the
<a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a>:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">and</span><span class="o">(</span><span class="n">equal</span><span class="o">(&lt;</span><span class="n">field1</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;),</span> <span class="n">equal</span><span class="o">(&lt;</span><span class="n">field2</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value2</span><span class="o">&gt;)</span> <span class="o">...)</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>The following example selects from the <code class="docutils literal"><span class="pre">inventory</span></code> collection all
documents where the <code class="docutils literal"><span class="pre">status</span></code> equals <code class="docutils literal"><span class="pre">&quot;D&quot;</span></code>:</p>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;D&quot;</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>Copy the following filter into the Compass query bar and click
<span class="guilabel">Find</span>:</p>
<div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;D&quot;</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<div class="figure">
<img alt="../_images/compass-find-filter-inventory.png" src="../_images/compass-find-filter-inventory.png" />
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;D&quot;</span><span class="p">})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findIterable</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;D&quot;</span><span class="o">));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="kr">const</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">find</span><span class="p">({</span> <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;D&#39;</span> <span class="p">});</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">([</span><span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;D&#39;</span><span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;D&quot;</span><span class="p">})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;D&quot;</span><span class="o">));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">filter</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">.</span><span class="n">Eq</span><span class="p">(</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span><span class="p">);</span>
<span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="n">collection</span><span class="p">.</span><span class="n">Find</span><span class="p">(</span><span class="n">filter</span><span class="p">).</span><span class="n">ToList</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">find</span><span class="p">(</span> <span class="p">{</span> <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;D&quot;</span> <span class="p">}</span> <span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">find</span><span class="p">(</span><span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;D&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">findObservable</span> <span class="k">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="o">(</span><span class="n">equal</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;D&quot;</span><span class="o">))</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">Find</span><span class="p">(</span>
	<span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span><span class="p">}},</span>
<span class="p">)</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>This operation corresponds to the following SQL statement:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-sql"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">inventory</span> <span class="k">WHERE</span> <span class="n">status</span> <span class="o">=</span> <span class="ss">&quot;D&quot;</span>
</pre></div>
</div>
</div>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="true">Compass</li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-compass" data-tabid="compass"><div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The MongoDB Compass query bar autocompletes the current query
based on the keys in your collection’s documents, including
keys in embedded sub-documents.</p>
</div>
    </div>
  </div>
</div></div>
<div class="section" id="specify-conditions-using-query-operators">
<h2>Specify Conditions Using Query Operators<a class="headerlink" href="#specify-conditions-using-query-operators" title="Permalink to this headline">¶</a></h2>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="p">{</span> <span class="o">&lt;</span><span class="nx">operator1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span> <span class="p">},</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="p">{</span> <span class="o">&lt;</span><span class="nx">operator1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span> <span class="p">},</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;</span><span class="p">:</span> <span class="p">{</span> <span class="o">&lt;</span><span class="n">operator1</span><span class="o">&gt;</span><span class="p">:</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;</span> <span class="p">},</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><p>In addition to the equality condition, MongoDB provides
various <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
filter conditions. Use the
<a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/model/Filters.html">com.mongodb.client.model.Filters</a> helper methods to
facilitate the creation of filter documents. For example:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">and</span><span class="o">(</span><span class="n">gte</span><span class="o">(&lt;</span><span class="n">field1</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;),</span> <span class="n">lt</span><span class="o">(&lt;</span><span class="n">field2</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value2</span><span class="o">&gt;),</span> <span class="n">eq</span><span class="o">(&lt;</span><span class="n">field3</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value3</span><span class="o">&gt;))</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="p">{</span> <span class="o">&lt;</span><span class="nx">operator1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span> <span class="p">},</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;</span> <span class="o">=&gt;</span> <span class="p">[</span> <span class="o">&lt;</span><span class="nx">operator1</span><span class="o">&gt;</span> <span class="o">=&gt;</span> <span class="o">&lt;</span><span class="nx">value1</span><span class="o">&gt;</span> <span class="p">],</span> <span class="o">...</span> <span class="p">]</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;</span><span class="p">:</span> <span class="p">{</span> <span class="o">&lt;</span><span class="n">operator1</span><span class="o">&gt;</span><span class="p">:</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;</span> <span class="p">},</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><p>In addition to the equality condition, MongoDB provides
various <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
filter conditions. Use the
<a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/model/Filters.html">com.mongodb.client.model.Filters</a> helper methods to
facilitate the creation of filter documents. For example:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">and</span><span class="o">(</span><span class="n">gte</span><span class="o">(&lt;</span><span class="n">field1</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;),</span> <span class="n">lt</span><span class="o">(&lt;</span><span class="n">field2</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value2</span><span class="o">&gt;),</span> <span class="n">eq</span><span class="o">(&lt;</span><span class="n">field3</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value3</span><span class="o">&gt;))</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><p>In addition to the equality filter, MongoDB provides
various <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
filter conditions. Use the
<a class="reference external" href="https://api.mongodb.com/csharp/current/html/T_MongoDB_Driver_FilterDefinitionBuilder_1.htm">FilterDefinitionBuilder</a>
methods to create a filter document. For example:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">builder</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">;</span>
<span class="n">builder</span><span class="p">.</span><span class="n">And</span><span class="p">(</span><span class="n">builder</span><span class="p">.</span><span class="n">Eq</span><span class="p">(&lt;</span><span class="n">field1</span><span class="p">&gt;,</span> <span class="p">&lt;</span><span class="n">value1</span><span class="p">&gt;),</span> <span class="n">builder</span><span class="p">.</span><span class="n">Lt</span><span class="p">(&lt;</span><span class="n">field2</span><span class="p">&gt;,</span> <span class="p">&lt;</span><span class="n">value2</span><span class="p">&gt;));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="sr">&lt;field1&gt;</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="sr">&lt;operator1&gt;</span> <span class="o">=&gt;</span> <span class="sr">&lt;value1&gt;</span> <span class="p">},</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><p>A <a class="reference internal" href="../core/document.html#document-query-filter"><span class="std std-ref">query filter document</span></a> can
use the <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
conditions in the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="n">field1</span><span class="o">&gt;</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="o">&lt;</span><span class="n">operator1</span><span class="o">&gt;</span> <span class="o">=&gt;</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;</span> <span class="p">},</span> <span class="o">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><p>In addition to the equality condition, MongoDB provides
various <a class="reference internal" href="../reference/operator/query.html#query-selectors"><span class="std std-ref">query operators</span></a> to specify
filter conditions. Use the
<code class="docutils literal"><span class="pre">com.mongodb.client.model.Filters_</span></code> helper methods to
facilitate the creation of filter documents. For example:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">and</span><span class="o">(</span><span class="n">gte</span><span class="o">(&lt;</span><span class="n">field1</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value1</span><span class="o">&gt;),</span> <span class="n">lt</span><span class="o">(&lt;</span><span class="n">field2</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value2</span><span class="o">&gt;),</span> <span class="n">equal</span><span class="o">(&lt;</span><span class="n">field3</span><span class="o">&gt;,</span> <span class="o">&lt;</span><span class="n">value3</span><span class="o">&gt;))</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>The following example retrieves all documents from the <code class="docutils literal"><span class="pre">inventory</span></code>
collection where <code class="docutils literal"><span class="pre">status</span></code> equals either <code class="docutils literal"><span class="pre">&quot;A&quot;</span></code> or <code class="docutils literal"><span class="pre">&quot;D&quot;</span></code>:</p>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$in</span><span class="o">:</span> <span class="p">[</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="s2">&quot;D&quot;</span> <span class="p">]</span> <span class="p">}</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>Copy the following filter into the Compass query bar and click
<span class="guilabel">Find</span>:</p>
<div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$in</span><span class="o">:</span> <span class="p">[</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="s2">&quot;D&quot;</span> <span class="p">]</span> <span class="p">}</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<div class="figure">
<img alt="../_images/compass-find-filter-query-op.png" src="../_images/compass-find-filter-query-op.png" />
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$in&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="s2">&quot;D&quot;</span><span class="p">]}})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findIterable</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">in</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">,</span> <span class="s">&quot;D&quot;</span><span class="o">));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="kr">const</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">find</span><span class="p">({</span>
  <span class="nx">status</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$in</span><span class="o">:</span> <span class="p">[</span><span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="s1">&#39;D&#39;</span><span class="p">]</span> <span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">([</span><span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;$in&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="s1">&#39;D&#39;</span><span class="p">]]]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$in&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="s2">&quot;D&quot;</span><span class="p">]}})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">in</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">,</span> <span class="s">&quot;D&quot;</span><span class="o">));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">filter</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">.</span><span class="n">In</span><span class="p">(</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="k">new</span><span class="p">[]</span> <span class="p">{</span> <span class="s">&quot;A&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span> <span class="p">});</span>
<span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="n">collection</span><span class="p">.</span><span class="n">Find</span><span class="p">(</span><span class="n">filter</span><span class="p">).</span><span class="n">ToList</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">find</span><span class="p">(</span> <span class="p">{</span> <span class="n">status</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="s">&#39;$in&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span> <span class="s">&quot;A&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span> <span class="p">]</span> <span class="p">}</span> <span class="p">}</span> <span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">find</span><span class="p">(</span><span class="ss">status</span><span class="p">:</span> <span class="p">{</span> <span class="s1">&#39;$in&#39;</span> <span class="o">=&gt;</span> <span class="o">[</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="s1">&#39;D&#39;</span> <span class="o">]</span><span class="p">})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">findObservable</span> <span class="k">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="o">(</span><span class="n">in</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">,</span> <span class="s">&quot;D&quot;</span><span class="o">))</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">Find</span><span class="p">(</span>
	<span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;$in&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">A</span><span class="p">{</span><span class="s">&quot;A&quot;</span><span class="p">,</span> <span class="s">&quot;D&quot;</span><span class="p">}}}}})</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Although you can express this query using the <a class="reference internal" href="../reference/operator/query/or.html#op._S_or" title="$or"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$or</span></code></a> operator,
use the <a class="reference internal" href="../reference/operator/query/in.html#op._S_in" title="$in"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$in</span></code></a> operator rather than the <a class="reference internal" href="../reference/operator/query/or.html#op._S_or" title="$or"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$or</span></code></a>
operator when performing equality checks on the same field.</p>
</div>
<p>The operation corresponds to the following SQL statement:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-sql"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">inventory</span> <span class="k">WHERE</span> <span class="n">status</span> <span class="k">in</span> <span class="p">(</span><span class="ss">&quot;A&quot;</span><span class="p">,</span> <span class="ss">&quot;D&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<p>Refer to the <a class="reference internal" href="../reference/operator/query.html"><span class="doc">Query and Projection Operators</span></a> document for the complete
list of MongoDB query operators.</p>
</div>
<div class="section" id="specify-and-conditions">
<h2>Specify <code class="docutils literal"><span class="pre">AND</span></code> Conditions<a class="headerlink" href="#specify-and-conditions" title="Permalink to this headline">¶</a></h2>
<p>A compound query can specify conditions for more than one field in the
collection’s documents. Implicitly, a logical <code class="docutils literal"><span class="pre">AND</span></code> conjunction
connects the clauses of a compound query so that the query selects the
documents in the collection that match all the conditions.</p>
<p>The following example retrieves all documents in the <code class="docutils literal"><span class="pre">inventory</span></code>
collection where the <code class="docutils literal"><span class="pre">status</span></code> equals <code class="docutils literal"><span class="pre">&quot;A&quot;</span></code> <strong>and</strong> <code class="docutils literal"><span class="pre">qty</span></code> is less
than (<a class="reference internal" href="../reference/operator/query/lt.html#op._S_lt" title="$lt"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$lt</span></code></a>) <code class="docutils literal"><span class="pre">30</span></code>:</p>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>Copy the following filter into the Compass query bar and click
<span class="guilabel">Find</span>:</p>
<div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<div class="figure">
<img alt="../_images/compass-find-filter-and.png" src="../_images/compass-find-filter-and.png" />
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$lt&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">}})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findIterable</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">and</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span> <span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">)));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="kr">const</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">find</span><span class="p">({</span>
  <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
  <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">([</span>
    <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
    <span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span><span class="p">],</span>
<span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$lt&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">}})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">and</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span> <span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">)));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">builder</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">;</span>
<span class="kt">var</span> <span class="n">filter</span> <span class="p">=</span> <span class="n">builder</span><span class="p">.</span><span class="n">And</span><span class="p">(</span><span class="n">builder</span><span class="p">.</span><span class="n">Eq</span><span class="p">(</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">),</span> <span class="n">builder</span><span class="p">.</span><span class="n">Lt</span><span class="p">(</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">30</span><span class="p">));</span>
<span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="n">collection</span><span class="p">.</span><span class="n">Find</span><span class="p">(</span><span class="n">filter</span><span class="p">).</span><span class="n">ToList</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">find</span><span class="p">(</span> <span class="p">{</span> <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;A&quot;</span><span class="p">,</span> <span class="n">qty</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="s">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span> <span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">find</span><span class="p">(</span><span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="ss">qty</span><span class="p">:</span> <span class="p">{</span> <span class="s1">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span> <span class="p">})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">findObservable</span> <span class="k">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="o">(</span><span class="n">and</span><span class="o">(</span><span class="n">equal</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span> <span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">)))</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">Find</span><span class="p">(</span>
	<span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;$lt&quot;</span><span class="p">,</span> <span class="mi">30</span><span class="p">}}},</span>
	<span class="p">})</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>The operation corresponds to the following SQL statement:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-sql"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">inventory</span> <span class="k">WHERE</span> <span class="n">status</span> <span class="o">=</span> <span class="ss">&quot;A&quot;</span> <span class="k">AND</span> <span class="n">qty</span> <span class="o">&lt;</span> <span class="mi">30</span>
</pre></div>
</div>
</div>
<p>See <a class="reference internal" href="../reference/operator/query-comparison.html#query-selectors-comparison"><span class="std std-ref">comparison operators</span></a> for other
MongoDB comparison operators.</p>
</div>
<div class="section" id="specify-or-conditions">
<h2>Specify <code class="docutils literal"><span class="pre">OR</span></code> Conditions<a class="headerlink" href="#specify-or-conditions" title="Permalink to this headline">¶</a></h2>
<p>Using the <a class="reference internal" href="../reference/operator/query/or.html#op._S_or" title="$or"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$or</span></code></a> operator, you can specify a compound query
that joins each clause with a logical <code class="docutils literal"><span class="pre">OR</span></code> conjunction so that the
query selects the documents in the collection that match at least one
condition.</p>
<p>The following example retrieves all documents in the collection where
the <code class="docutils literal"><span class="pre">status</span></code> equals <code class="docutils literal"><span class="pre">&quot;A&quot;</span></code> <strong>or</strong> <code class="docutils literal"><span class="pre">qty</span></code> is less than
(<a class="reference internal" href="../reference/operator/query/lt.html#op._S_lt" title="$lt"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$lt</span></code></a>) <code class="docutils literal"><span class="pre">30</span></code>:</p>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span> <span class="nx">$or</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span> <span class="p">]</span> <span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>Copy the following filter into the Compass query bar and click
<span class="guilabel">Find</span>:</p>
<div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="nx">$or</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span> <span class="p">]</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<div class="figure">
<img alt="../_images/compass-find-filter-or.png" src="../_images/compass-find-filter-or.png" />
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">(</span>
    <span class="p">{</span><span class="s2">&quot;$or&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">},</span> <span class="p">{</span><span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$lt&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">}}]})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findIterable</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">or</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span> <span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">)));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="kr">const</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">find</span><span class="p">({</span>
  <span class="nx">$or</span><span class="o">:</span> <span class="p">[{</span> <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;A&#39;</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}]</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">([</span>
    <span class="s1">&#39;$or&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span>
        <span class="p">[</span><span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;A&#39;</span><span class="p">],</span>
        <span class="p">[</span><span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span><span class="p">]],</span>
    <span class="p">],</span>
<span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">(</span>
    <span class="p">{</span><span class="s2">&quot;$or&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">},</span> <span class="p">{</span><span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$lt&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">}}]})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="n">or</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span> <span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">)));</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">builder</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">;</span>
<span class="kt">var</span> <span class="n">filter</span> <span class="p">=</span> <span class="n">builder</span><span class="p">.</span><span class="n">Or</span><span class="p">(</span><span class="n">builder</span><span class="p">.</span><span class="n">Eq</span><span class="p">(</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">),</span> <span class="n">builder</span><span class="p">.</span><span class="n">Lt</span><span class="p">(</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">30</span><span class="p">));</span>
<span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="n">collection</span><span class="p">.</span><span class="n">Find</span><span class="p">(</span><span class="n">filter</span><span class="p">).</span><span class="n">ToList</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">find</span><span class="p">(</span>
    <span class="p">{</span> <span class="s">&#39;$or&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span> <span class="p">{</span> <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;A&quot;</span> <span class="p">},</span> <span class="p">{</span> <span class="n">qty</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="s">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span> <span class="p">]</span> <span class="p">}</span>
<span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">find</span><span class="p">(</span><span class="s1">&#39;$or&#39;</span> <span class="o">=&gt;</span> <span class="o">[</span><span class="p">{</span> <span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;A&#39;</span> <span class="p">},</span>
                                  <span class="p">{</span> <span class="ss">qty</span><span class="p">:</span> <span class="p">{</span> <span class="s1">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">}</span>
                                 <span class="o">]</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">findObservable</span> <span class="k">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="o">(</span><span class="n">or</span><span class="o">(</span><span class="n">equal</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span> <span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">)))</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">Find</span><span class="p">(</span>
	<span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;$or&quot;</span><span class="p">,</span>
			<span class="nx">bson</span><span class="p">.</span><span class="nx">A</span><span class="p">{</span>
				<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">}},</span>
				<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;$lt&quot;</span><span class="p">,</span> <span class="mi">30</span><span class="p">}}}},</span>
			<span class="p">}},</span>
	<span class="p">})</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>The operation corresponds to the following SQL statement:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-sql"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">inventory</span> <span class="k">WHERE</span> <span class="n">status</span> <span class="o">=</span> <span class="ss">&quot;A&quot;</span> <span class="k">OR</span> <span class="n">qty</span> <span class="o">&lt;</span> <span class="mi">30</span>
</pre></div>
</div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Queries which use <a class="reference internal" href="../reference/operator/query-comparison.html#query-selectors-comparison"><span class="std std-ref">comparison operators</span></a>
are subject to <a class="reference internal" href="../reference/method/db.collection.find.html#type-bracketing"><span class="std std-ref">Type Bracketing</span></a>.</p>
</div>
<div class="section" id="specify-and-as-well-as-or-conditions">
<h3>Specify <code class="docutils literal"><span class="pre">AND</span></code> as well as <code class="docutils literal"><span class="pre">OR</span></code> Conditions<a class="headerlink" href="#specify-and-as-well-as-or-conditions" title="Permalink to this headline">¶</a></h3>
<p>In the following example, the compound query document selects all
documents in the collection where the <code class="docutils literal"><span class="pre">status</span></code> equals <code class="docutils literal"><span class="pre">&quot;A&quot;</span></code>
<strong>and</strong> <em>either</em> <code class="docutils literal"><span class="pre">qty</span></code> is less than (<a class="reference internal" href="../reference/operator/query/lt.html#op._S_lt" title="$lt"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$lt</span></code></a>) <code class="docutils literal"><span class="pre">30</span></code> <em>or</em>
<code class="docutils literal"><span class="pre">item</span></code> starts with the character <code class="docutils literal"><span class="pre">p</span></code>:</p>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="motor" aria-selected="false">Motor</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">inventory</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span>
     <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span>
     <span class="nx">$or</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="sr">/^p/</span> <span class="p">}</span> <span class="p">]</span>
<span class="p">}</span> <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>Copy the following filter into the Compass query bar and click
<span class="guilabel">Find</span>:</p>
<div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="nx">status</span><span class="o">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span> <span class="nx">$or</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="sr">/^p/</span> <span class="p">}</span> <span class="p">]</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<div class="figure">
<img alt="../_images/compass-find-filter-and-or.png" src="../_images/compass-find-filter-and-or.png" />
</div>
</div>
<div class="tabpanel-python" data-tabid="python"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span>
    <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span>
    <span class="s2">&quot;$or&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$lt&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">}},</span> <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$regex&quot;</span><span class="p">:</span> <span class="s2">&quot;^p&quot;</span><span class="p">}}]})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findIterable</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span>
        <span class="n">and</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span>
                <span class="n">or</span><span class="o">(</span><span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">),</span> <span class="n">regex</span><span class="o">(</span><span class="s">&quot;item&quot;</span><span class="o">,</span> <span class="s">&quot;^p&quot;</span><span class="o">)))</span>
<span class="o">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="kr">const</span> <span class="nx">cursor</span> <span class="o">=</span> <span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">(</span><span class="s1">&#39;inventory&#39;</span><span class="p">).</span><span class="nx">find</span><span class="p">({</span>
  <span class="nx">status</span><span class="o">:</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
  <span class="nx">$or</span><span class="o">:</span> <span class="p">[{</span> <span class="nx">qty</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$lt</span><span class="o">:</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">},</span> <span class="p">{</span> <span class="nx">item</span><span class="o">:</span> <span class="p">{</span> <span class="nx">$regex</span><span class="o">:</span> <span class="s1">&#39;^p&#39;</span> <span class="p">}</span> <span class="p">}]</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-php"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="na">inventory</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">([</span>
    <span class="s1">&#39;status&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
    <span class="s1">&#39;$or&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span>
        <span class="p">[</span><span class="s1">&#39;qty&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span><span class="p">]],</span>
        <span class="c1">// Alternatively: [&#39;item&#39; =&gt; new \MongoDB\BSON\Regex(&#39;^p&#39;)]</span>
        <span class="p">[</span><span class="s1">&#39;item&#39;</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="s1">&#39;$regex&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;^p&#39;</span><span class="p">]],</span>
    <span class="p">],</span>
<span class="p">]);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-motor" data-tabid="motor"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-python"><div class="highlight"><pre><span></span><span class="n">cursor</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">inventory</span><span class="o">.</span><span class="n">find</span><span class="p">({</span>
    <span class="s2">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;A&quot;</span><span class="p">,</span>
    <span class="s2">&quot;$or&quot;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&quot;qty&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$lt&quot;</span><span class="p">:</span> <span class="mi">30</span><span class="p">}},</span> <span class="p">{</span><span class="s2">&quot;item&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;$regex&quot;</span><span class="p">:</span> <span class="s2">&quot;^p&quot;</span><span class="p">}}]})</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-java"><div class="highlight"><pre><span></span><span class="n">findPublisher</span> <span class="o">=</span> <span class="n">collection</span><span class="o">.</span><span class="na">find</span><span class="o">(</span>
        <span class="n">and</span><span class="o">(</span><span class="n">eq</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span>
                <span class="n">or</span><span class="o">(</span><span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">),</span> <span class="n">regex</span><span class="o">(</span><span class="s">&quot;item&quot;</span><span class="o">,</span> <span class="s">&quot;^p&quot;</span><span class="o">)))</span>
<span class="o">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-c#"><div class="highlight"><pre><span></span><span class="kt">var</span> <span class="n">builder</span> <span class="p">=</span> <span class="n">Builders</span><span class="p">&lt;</span><span class="n">BsonDocument</span><span class="p">&gt;.</span><span class="n">Filter</span><span class="p">;</span>
<span class="kt">var</span> <span class="n">filter</span> <span class="p">=</span> <span class="n">builder</span><span class="p">.</span><span class="n">And</span><span class="p">(</span>
    <span class="n">builder</span><span class="p">.</span><span class="n">Eq</span><span class="p">(</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">),</span>
    <span class="n">builder</span><span class="p">.</span><span class="n">Or</span><span class="p">(</span><span class="n">builder</span><span class="p">.</span><span class="n">Lt</span><span class="p">(</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="m">30</span><span class="p">),</span> <span class="n">builder</span><span class="p">.</span><span class="n">Regex</span><span class="p">(</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">BsonRegularExpression</span><span class="p">(</span><span class="s">&quot;^p&quot;</span><span class="p">))));</span>
<span class="kt">var</span> <span class="n">result</span> <span class="p">=</span> <span class="n">collection</span><span class="p">.</span><span class="n">Find</span><span class="p">(</span><span class="n">filter</span><span class="p">).</span><span class="n">ToList</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-perl"><div class="highlight"><pre><span></span><span class="nv">$cursor</span> <span class="o">=</span> <span class="nv">$db</span><span class="o">-&gt;</span><span class="n">coll</span><span class="p">(</span><span class="s">&quot;inventory&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">find</span><span class="p">(</span>
    <span class="p">{</span>
        <span class="n">status</span> <span class="o">=&gt;</span> <span class="s">&quot;A&quot;</span><span class="p">,</span>
        <span class="s">&#39;$or&#39;</span>  <span class="o">=&gt;</span> <span class="p">[</span> <span class="p">{</span> <span class="n">qty</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="s">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">},</span> <span class="p">{</span> <span class="n">item</span> <span class="o">=&gt;</span> <span class="p">{</span> <span class="s">&#39;$regex&#39;</span> <span class="o">=&gt;</span> <span class="s">&quot;^p&quot;</span> <span class="p">}</span> <span class="p">}</span> <span class="p">]</span>
    <span class="p">}</span>
<span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-ruby"><div class="highlight"><pre><span></span><span class="n">client</span><span class="o">[</span><span class="ss">:inventory</span><span class="o">].</span><span class="n">find</span><span class="p">(</span><span class="ss">status</span><span class="p">:</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span>
                        <span class="s1">&#39;$or&#39;</span> <span class="o">=&gt;</span> <span class="o">[</span><span class="p">{</span> <span class="ss">qty</span><span class="p">:</span> <span class="p">{</span> <span class="s1">&#39;$lt&#39;</span> <span class="o">=&gt;</span> <span class="mi">30</span> <span class="p">}</span> <span class="p">},</span>
                                  <span class="p">{</span> <span class="ss">item</span><span class="p">:</span> <span class="p">{</span> <span class="s1">&#39;$regex&#39;</span> <span class="o">=&gt;</span> <span class="no">BSON</span><span class="o">::</span><span class="no">Regexp</span><span class="o">::</span><span class="no">Raw</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;^p&#39;</span><span class="p">)</span> <span class="p">}</span> <span class="p">}</span>
                        <span class="o">]</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-scala" data-tabid="scala"><div class="copyable-code button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-scala"><div class="highlight"><pre><span></span><span class="n">findObservable</span> <span class="k">=</span> <span class="n">collection</span><span class="o">.</span><span class="n">find</span><span class="o">(</span><span class="n">and</span><span class="o">(</span>
  <span class="n">equal</span><span class="o">(</span><span class="s">&quot;status&quot;</span><span class="o">,</span> <span class="s">&quot;A&quot;</span><span class="o">),</span>
  <span class="n">or</span><span class="o">(</span><span class="n">lt</span><span class="o">(</span><span class="s">&quot;qty&quot;</span><span class="o">,</span> <span class="mi">30</span><span class="o">),</span> <span class="n">regex</span><span class="o">(</span><span class="s">&quot;item&quot;</span><span class="o">,</span> <span class="s">&quot;^p&quot;</span><span class="o">)))</span>
<span class="o">)</span>
</pre></div>
</div>
</div>
</div>
<div class="tabpanel-go" data-tabid="go"><div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-go"><div class="highlight"><pre><span></span><span class="nx">cursor</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">coll</span><span class="p">.</span><span class="nx">Find</span><span class="p">(</span>
	<span class="nx">context</span><span class="p">.</span><span class="nx">Background</span><span class="p">(),</span>
	<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{</span>
		<span class="p">{</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">},</span>
		<span class="p">{</span><span class="s">&quot;$or&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">A</span><span class="p">{</span>
			<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;qty&quot;</span><span class="p">,</span> <span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;$lt&quot;</span><span class="p">,</span> <span class="mi">30</span><span class="p">}}}},</span>
			<span class="nx">bson</span><span class="p">.</span><span class="nx">D</span><span class="p">{{</span><span class="s">&quot;item&quot;</span><span class="p">,</span> <span class="nx">primitive</span><span class="p">.</span><span class="nx">Regex</span><span class="p">{</span><span class="nx">Pattern</span><span class="p">:</span> <span class="s">&quot;^p&quot;</span><span class="p">,</span> <span class="nx">Options</span><span class="p">:</span> <span class="s">&quot;&quot;</span><span class="p">}}},</span>
		<span class="p">}},</span>
	<span class="p">})</span>
</pre></div>
</div>
</div>
    </div>
  </div>
</div><p>The operation corresponds to the following SQL statement:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-sql"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">inventory</span> <span class="k">WHERE</span> <span class="n">status</span> <span class="o">=</span> <span class="ss">&quot;A&quot;</span> <span class="k">AND</span> <span class="p">(</span> <span class="n">qty</span> <span class="o">&lt;</span> <span class="mi">30</span> <span class="k">OR</span> <span class="n">item</span> <span class="k">LIKE</span> <span class="ss">&quot;p%&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">MongoDB supports regular expressions <a class="reference internal" href="../reference/operator/query/regex.html#op._S_regex" title="$regex"><code class="xref mongodb mongodb-query docutils literal"><span class="pre">$regex</span></code></a> queries to
perform string pattern matches.</p>
</div>
</div>
</div>
<div class="section" id="additional-query-tutorials">
<h2>Additional Query Tutorials<a class="headerlink" href="#additional-query-tutorials" title="Permalink to this headline">¶</a></h2>
<p>For additional query examples, see:</p>
<ul class="simple">
<li><a class="reference internal" href="query-embedded-documents.html"><span class="doc">Query on Embedded/Nested Documents</span></a></li>
<li><a class="reference internal" href="query-arrays.html"><span class="doc">Query an Array</span></a></li>
<li><a class="reference internal" href="query-array-of-documents.html"><span class="doc">Query an Array of Embedded Documents</span></a></li>
<li><a class="reference internal" href="project-fields-from-query-results.html"><span class="doc">Project Fields to Return from Query</span></a></li>
<li><a class="reference internal" href="query-for-null-fields.html"><span class="doc">Query for Null or Missing Fields</span></a></li>
</ul>
</div>
<div class="section" id="behavior">
<h2>Behavior<a class="headerlink" href="#behavior" title="Permalink to this headline">¶</a></h2>
<div class="section" id="cursor">
<h3>Cursor<a class="headerlink" href="#cursor" title="Permalink to this headline">¶</a></h3>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><p>The <a class="reference internal" href="../reference/method/db.collection.find.html#db.collection.find" title="db.collection.find()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.find()</span></code></a> method
returns a <a class="reference internal" href="iterate-a-cursor.html"><span class="doc">cursor</span></a> to the matching
documents.</p>
</div>
<div class="tabpanel-compass" data-tabid="compass"><p>The MongoDB Compass <span class="guilabel">Find</span> operation opens a
<a class="reference internal" href="iterate-a-cursor.html"><span class="doc">cursor</span></a> to the matching
documents of the collection based on the find query.</p>
<p>For more information on sampling in MongoDB Compass, see the
<a class="reference external" href="https://docs.mongodb.com/compass/current/faq/#compass-faq" title="(in compass vmaster)"><span class="xref std std-ref">Compass FAQ</span></a>.</p>
</div>
<div class="tabpanel-python" data-tabid="python"><p>The <a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">pymongo.collection.Collection.find()</span></code></a> method
returns a <a class="reference internal" href="iterate-a-cursor.html"><span class="doc">cursor</span></a> to the
matching documents. See the PyMongo documentation for
<a class="reference external" href="http://api.mongodb.com/python/current/tutorial.html#querying-for-more-than-one-document">iterating over a cursor</a>.</p>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><p>The <a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/MongoCollection.html#find--">com.mongodb.client.MongoCollection.find</a> method returns an
instance of the <a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/javadoc/com/mongodb/client/FindIterable.html">com.mongodb.client.FindIterable</a> interface.</p>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><p>The <a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#find">Collection.find()</a> method
returns a <a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Cursor.html">cursor</a>.</p>
</div>
<div class="tabpanel-php" data-tabid="php"><p>The <a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-find/#phpmethod.MongoDB\Collection::find" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">MongoDB\Collection::find()</span></code></a>
method returns a <a class="reference internal" href="iterate-a-cursor.html"><span class="doc">cursor</span></a> to
the matching documents. See the MongoDB PHP Library
documentation for
<a class="reference external" href="https://docs.mongodb.com/php-library/master/tutorial/crud/#php-find-many-documents" title="(in php-library-manual vmaster)"><span class="xref std std-ref">iterating over a cursor</span></a>.</p>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><p><a class="reference external" href="http://mongodb.github.io/mongo-java-driver-reactivestreams/1.6/javadoc/com/mongodb/reactivestreams/client/MongoCollection.html#find()">com.mongodb.reactivestreams.client.MongoCollection.find</a>
returns an instance of the <a class="reference external" href="http://mongodb.github.io/mongo-java-driver-reactivestreams/1.6/javadoc/com/mongodb/reactivestreams/client/FindPublisher.html">com.mongodb.reactivestreams.client.FindPublisher</a>
interface.</p>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><p>The <a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_Find.htm">MongoCollection.Find()</a>
method returns a <a class="reference internal" href="iterate-a-cursor.html"><span class="doc">cursor</span></a> to
the matching documents. See the MongoDB C# driver
documentation for
<a class="reference external" href="https://mongodb.github.io/mongo-csharp-driver/2.4/reference/driver/crud/reading/#finding-documents">iterating over a cursor</a>.</p>
</div>
<div class="tabpanel-perl" data-tabid="perl"><p>The <a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find">MongoDB::Collection::find()</a>
method returns a <a class="reference internal" href="iterate-a-cursor.html"><span class="doc">cursor</span></a> to
the matching documents. See the MongoDB Perl driver
documentation for
<a class="reference external" href="https://metacpan.org/pod/distribution/MongoDB/lib/MongoDB/Tutorial.pod#Cursors">iterating over a cursor</a>.</p>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><p>The <a class="reference external" href="https://api.mongodb.com/ruby/current/Mongo/Collection.html#find-instance_method">Mongo::Collection#find()</a>
method returns a <a class="reference external" href="https://api.mongodb.com/ruby/current/Mongo/Collection/View.html">CollectionView</a>,
which is an <code class="docutils literal"><span class="pre">Enumerable</span></code>. A <a class="reference external" href="https://api.mongodb.com/ruby/current/Mongo/Cursor.html">Cursor</a> is
created when the <code class="docutils literal"><span class="pre">View</span></code> is enumerated; for example, by calling
<code class="docutils literal"><span class="pre">#to_a()</span></code> or <code class="docutils literal"><span class="pre">#each()</span></code>. You can also get an <code class="docutils literal"><span class="pre">Enumerator</span></code> by calling
<code class="docutils literal"><span class="pre">#to_enum()</span></code> on the <code class="docutils literal"><span class="pre">View</span></code>. See the Ruby driver API documentation
for <a class="reference external" href="http://api.mongodb.com/ruby/current/Mongo/Cursor.html#each-instance_method">iterating over a cursor</a>.</p>
</div>
<div class="tabpanel-scala" data-tabid="scala"><p>The <a class="reference external" href="https://mongodb.github.io/mongo-scala-driver/2.0/scaladoc/org/mongodb/scala/MongoCollection.html#find[C](filter:org.mongodb.scala.bson.conversions.Bson)(implicite:org.mongodb.scala.bson.DefaultHelper.DefaultsTo[C,TResult],implicitct:scala.reflect.ClassTag[C]):org.mongodb.scala.FindObservable[C]">collection.find()</a>
method returns the find <a class="reference external" href="http://mongodb.github.io/mongo-scala-driver/2.1/reference/observables/">Observable</a>.</p>
</div>
<div class="tabpanel-go" data-tabid="go"><p>The <a class="reference external" href="https://godoc.org/github.com/mongodb/mongo-go-driver/mongo#Collection.Find">Collection.Find</a>
function returns a <a class="reference external" href="https://godoc.org/github.com/mongodb/mongo-go-driver/mongo#Cursor">Cursor</a> to the
matching documents. See the <a class="reference external" href="https://godoc.org/github.com/mongodb/mongo-go-driver/mongo#Cursor">Cursor</a>
documentation for more information.</p>
    </div>
  </div>
</div></div>
<div class="section" id="read-isolation">
<h3>Read Isolation<a class="headerlink" href="#read-isolation" title="Permalink to this headline">¶</a></h3>
<div class="versionadded">
<p><span class="versionmodified">New in version 3.2.</span></p>
</div>
<p>For reads to <a class="reference internal" href="../replication.html"><span class="doc">replica sets</span></a> and replica set
<a class="reference internal" href="../sharding.html"><span class="doc">shards</span></a>, read concern allows clients to choose a
level of isolation for their reads. For more information, see
<a class="reference internal" href="../reference/read-concern.html"><span class="doc">Read Concern</span></a>.</p>
<div class="tabs" data-tab-preference="languages">
  <ul class="tab-strip tab-strip--singleton" role="tablist">
    <li class="tab-strip__element" data-tabid="shell" role="tab" aria-selected="true">Mongo Shell</li>
    <li class="tab-strip__element" data-tabid="compass" role="tab" aria-selected="false">Compass</li>
    <li class="tab-strip__element" data-tabid="python" role="tab" aria-selected="false">Python</li>
    <li class="tab-strip__element" data-tabid="javasync" role="tab" aria-selected="false">Java (Sync)</li>
    <li class="tab-strip__element" data-tabid="nodejs" role="tab" aria-selected="false">Node.js</li>
    <li class="tab-strip__element dropdown">
      <a class="dropdown-toggle" data-toggle="dropdown">Other <span class="caret"></span></a>
      <ul class="dropdown-menu tab-strip__dropdown" role="menu">
        <li data-tabid="php" aria-selected="false">PHP</li>
        <li data-tabid="javaasync" aria-selected="false">Java (Async)</li>
        <li data-tabid="csharp" aria-selected="false">C#</li>
        <li data-tabid="perl" aria-selected="false">Perl</li>
        <li data-tabid="ruby" aria-selected="false">Ruby</li>
        <li data-tabid="scala" aria-selected="false">Scala</li>
        <li data-tabid="go" aria-selected="false">Go</li>
      </ul>
    </li>
  </ul>
  <div class="tabs__content" role="tabpanel">
    <div class="tabpanel-shell" data-tabid="shell"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference internal" href="../reference/method/db.collection.findOne.html#db.collection.findOne" title="db.collection.findOne"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.findOne</span></code></a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference internal" href="../reference/method/db.collection.findOne.html#db.collection.findOne" title="db.collection.findOne()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.findOne()</span></code></a> method also performs a read
operation to return a single document. Internally, the
<a class="reference internal" href="../reference/method/db.collection.findOne.html#db.collection.findOne" title="db.collection.findOne()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.findOne()</span></code></a> method is the
<a class="reference internal" href="../reference/method/db.collection.find.html#db.collection.find" title="db.collection.find()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.find()</span></code></a> method with a limit of 1.</p>
</div>
</div>
<div class="tabpanel-compass" data-tabid="compass"><h2>Additional Options</h2><p>In addition to <code class="docutils literal"><span class="pre">filter</span></code>, MongoDB Compass also allows the
following options to be passed to the query bar:</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference external" href="https://docs.mongodb.com/compass/master/query-bar/#query-bar-project">Project</a></td>
<td>Specify which fields to return in the resulting data.</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="https://docs.mongodb.com/compass/master/query-bar/#query-bar-sort">Sort</a></td>
<td>Specify the sort order of the returned documents.</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="https://docs.mongodb.com/compass/master/query-bar/#query-bar-skip">Skip</a></td>
<td>Specify the first n-number of document to skip before returning the result set.</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="https://docs.mongodb.com/compass/master/query-bar/#query-bar-limit">Limit</a></td>
<td>Specify the maximum number of documents to return.</td>
</tr>
</tbody>
</table>
</div>
<div class="tabpanel-python" data-tabid="python"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">pymongo.collection.Collection.find_one()</span></code></a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the <a class="reference external" href="https://api.mongodb.com/python/current/examples/aggregation.html#aggregate-examples">PyMongo Aggregation Examples</a>.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">pymongo.collection.Collection.find_one()</span></code></a>
method also performs a read operation to return a single
document. Internally, the
<a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find_one" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">pymongo.collection.Collection.find_one()</span></code></a> method is
the <a class="reference external" href="https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find" title="(in PyMongo v3.9.0)"><code class="xref py py-meth docutils literal"><span class="pre">pymongo.collection.Collection.find()</span></code></a> method
with a limit of 1.</p>
</div>
</div>
<div class="tabpanel-javasync" data-tabid="javasync"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li>In the <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>,
the <a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to
MongoDB queries. See the <a class="reference external" href="https://mongodb.github.io/mongo-java-driver/3.4/driver/tutorials/aggregation/">Java Synchronous Driver Aggregation
Examples</a>.</li>
</ul>
</div>
<div class="tabpanel-nodejs" data-tabid="nodejs"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#findOne">Collection.findOne()</a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the MongoDB Node.js Driver’s
<a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/tutorials/aggregation/">aggregation tutorial</a>.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#findOne">Collection.findOne()</a>
method also performs a read operation to return a single
document. Internally, the
<a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#findOne">Collection.findOne()</a>
method is the
<a class="reference external" href="https://mongodb.github.io/node-mongodb-native/3.3/api/Collection.html#find">Collection.find()</a> method
with a limit of 1.</p>
</div>
</div>
<div class="tabpanel-php" data-tabid="php"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-findOne/#phpmethod.MongoDB\Collection::findOne" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">MongoDB\Collection::findOne()</span></code></a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the MongoDB PHP Library’s
<a class="reference external" href="https://docs.mongodb.com/php-library/master/tutorial/crud/#php-aggregation" title="(in php-library-manual vmaster)"><span class="xref std std-ref">aggregation example</span></a>.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-findOne/#phpmethod.MongoDB\Collection::findOne" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">MongoDB\Collection::findOne()</span></code></a>
method also performs a read operation to return a single
document. Internally, the
<a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-findOne/#phpmethod.MongoDB\Collection::findOne" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">MongoDB\Collection::findOne()</span></code></a>
method is the
<a class="reference external" href="https://docs.mongodb.com/php-library/master/reference/method/MongoDBCollection-find/#phpmethod.MongoDB\Collection::find" title="(in php-library-manual vmaster)"><code class="xref mongodb mongodb-phpmethod docutils literal"><span class="pre">MongoDB\Collection::find()</span></code></a>
method with a limit of 1.</p>
</div>
</div>
<div class="tabpanel-javaasync" data-tabid="javaasync"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>,
the <a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to
MongoDB queries. See <a class="reference external" href="http://mongodb.github.io/mongo-java-driver-reactivestreams/1.6/javadoc/com/mongodb/reactivestreams/client/MongoCollection.html#aggregate(java.util.List)">com.mongodb.reactivestreams.client.MongoCollection.aggregate</a>
for more information.</li>
</ul>
</div>
<div class="tabpanel-csharp" data-tabid="csharp"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_FindOne_1.htm">MongoCollection.FindOne()</a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the MongoDB C# driver’s
<a class="reference external" href="https://mongodb.github.io/mongo-csharp-driver/2.4/reference/driver/crud/linq/">LINQ documentation</a>.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_FindOne_1.htm">MongoCollection.FindOne()</a>
method also performs a read operation to return a single
document. Internally, the
<a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_FindOne_1.htm">MongoCollection.FindOne()</a>
method is the
<a class="reference external" href="https://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_MongoCollection_1_Find.htm">MongoCollection.Find()</a>
method with a limit of 1.</p>
</div>
</div>
<div class="tabpanel-perl" data-tabid="perl"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find_one">MongoDB::Collection::find_one()</a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the MongoDB Perl driver’s
<a class="reference external" href="https://metacpan.org/pod/distribution/MongoDB/lib/MongoDB/Examples.pod#AGGREGATION">aggregation examples</a>.</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The <a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find_one">MongoDB::Collection::find_one()</a>
method also performs a read operation to return a single
document. Internally, the
<a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find_one">MongoDB::Collection::find_one()</a>
method is the
<a class="reference external" href="https://metacpan.org/pod/MongoDB::Collection#find">MongoDB::Collection::find()</a>
method with a limit of 1.</p>
</div>
</div>
<div class="tabpanel-ruby" data-tabid="ruby"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the MongoDB Ruby driver’s
<a class="reference external" href="https://docs.mongodb.com/ruby-driver/master/tutorials/ruby-driver-aggregation/">aggregation examples</a>.</li>
</ul>
</div>
<div class="tabpanel-scala" data-tabid="scala"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>, the
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to MongoDB
queries. See the MongoDB Scala driver’s <a class="reference external" href="https://mongodb.github.io/mongo-scala-driver/2.0/scaladoc/org/mongodb/scala/MongoCollection.html#aggregate[C](pipeline:Seq[org.mongodb.scala.bson.conversions.Bson])(implicite:org.mongodb.scala.bson.DefaultHelper.DefaultsTo[C,TResult],implicitct:scala.reflect.ClassTag[C]):org.mongodb.scala.AggregateObservable[C]">aggregate method</a>.</li>
</ul>
</div>
<div class="tabpanel-go" data-tabid="go"><h2>Additional Methods</h2><p>The following methods can also read documents from a collection:</p>
<ul class="simple">
<li><a class="reference external" href="https://godoc.org/github.com/mongodb/mongo-go-driver/mongo#Collection.FindOne">Collection.FindOne</a></li>
<li>In <a class="reference internal" href="../core/aggregation-pipeline.html"><span class="doc">aggregation pipeline</span></a>,
the <a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> pipeline stage provides access to
MongoDB queries. See
<a class="reference external" href="https://godoc.org/github.com/mongodb/mongo-go-driver/mongo#Collection.Aggregate">Collection.Aggregate</a>.</li>
</ul>
    </div>
  </div>
</div><div class="toctree-wrapper compound">
</div>
</div>
</div>
</div>

                
    <div id="btnv">
      <span class="btn-arrow-left">&larr; &nbsp;</span>
      <a class="btn-prev-text" href="../reference/insert-methods.html" title="Previous Section: Insert Methods"><span>Insert Methods</span></a>
      <a class="btn-next-text" href="query-embedded-documents.html" title="Next Section: Query on Embedded/Nested Documents"><span>Query on Embedded/Nested Documents</span></a>
      <span class="btn-arrow-right">&nbsp;&rarr;</span>
    </div>
                  <div class="footer">
                    <div class="copyright">
                      <p>&copy; MongoDB, Inc 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.</p>
                    </div>
                  </div>
              </div></div>
            </div>
        </div>
    </div>
    <div class="right-column">
      <div class="wrapper"> <div id='mongodb-docs-1'>
   <script type='text/javascript'>
      googletag.cmd.push(function() { googletag.display('mongodb-docs-1'); });
   </script>
</div>
            <div class="social">
               <a class="slack-icon" href="https://slackpass.io/mongo-db?jmp=docs" title="https://slackpass.io/mongo-db?jmp=docs"><i class="fab fa-slack" aria-hidden="true"></i></a>
               <a class="twitter-icon" href="https://twitter.com/MongoDB" title="https://twitter.com/MongoDB"><i class="fab fa-twitter-square"></i></a>
               <a class="youtube-icon" href="https://www.youtube.com/user/MongoDB" title="https://www.youtube.com/user/MongoDB"><i class="fab fa-youtube-square"></i></a>
               <a class="facebook-icon" href="https://www.facebook.com/mongodb" title="https://www.facebook.com/mongodb"><i class="fab fa-facebook-square"></i></a>
               <a class="stack-overflow-icon" href="https://stackoverflow.com/tags/mongodb/info" title="https://stackoverflow.com/tags/mongodb/info"><i class="fab fa-stack-overflow" aria-hidden="true"></i></a>
            </div>
        

      </div>
    </div>
    
      <div id="rating-panel"></div>
    
    <div class="clearfix"></div>
  </div>
  

  <script type="text/javascript">
  // Bootstrap array of links that should trigger a full page reload
  window.docsExcludedNav = ['/administration', '/administration/production-checklist', '/administration/indexes-management', '/aggregation', '/applications/geospatial-indexes', '/applications/indexes', '/contributors/getting-started', '/core/2d', '/core/2dsphere', '/core/auditing', '/core/authentication', '/core/authorization', '/core/backups', '/core/read-isolation-consistency-recency', '/core/databases-and-collections', '/core/geohaystack', '/core/index-single', '/core/index-compound', '/core/index-creation', '/core/index-hashed', '/core/index-multikey', '/core/index-partial', '/core/index-sparse', '/core/index-text', '/core/index-ttl', '/core/index-unique', '/core/index-wildcard', '/core/journaling', '/core/kerberos', '/core/map-reduce', '/core/operational-segregation', '/core/query-optimization', '/core/read-preference', '/core/replica-set-architectures', '/core/replica-set-high-availability', '/core/replica-set-members', '/core/replica-set-secondary', '/core/transactions', '/geospatial-queries', '/replication', '/core/sharded-cluster-components', '/core/wiredtiger', '/core/write-operations-atomicity', '/crud', '/indexes', '/installation', '/introduction', '/mongo', '/products/bi-connector', '/reference/command', '/reference/collation', '/text-search', '/tutorial/manage-the-database-profiler', '/core/index-text', '/reference/bson-types', '/reference/configuration-options', '/reference/indexes', '/reference/method', '/reference/operator/aggregation', '/reference/operator/query', '/reference/operator/query-modifier', '/reference/operator/update', '/reference/replication', '/reference/read-concern', '/reference/security', '/reference/sharding', '/reference/write-concern', '/release-notes/2.4', '/release-notes/2.6', '/release-notes/2.8', '/release-notes/3.0', '/release-notes/3.2', '/release-notes/3.4', '/release-notes/3.6', '/release-notes/4.0', '/release-notes/4.2', '/security', '/sharding', '/changeStreams', '/core/zone-sharding', '/core/hashed-sharding', '/core/ranged-sharding', '/storage', '/tutorial/change-sharded-cluster-wiredtiger', '/tutorial/insert-documents', '/tutorial/query-documents', '/tutorial/remove-documents', '/tutorial/update-documents', '/tutorial/enable-authentication', '/tutorial/install-mongodb-on-ubuntu', '/tutorial/install-mongodb-on-windows', '/tutorial/install-mongodb-on-red-hat', '/tutorial/install-mongodb-on-debian', '/tutorial/install-mongodb-on-suse', '/tutorial/install-mongodb-on-amazon', '/tutorial/install-mongodb-enterprise-on-ubuntu', '/tutorial/install-mongodb-enterprise-on-windows', '/tutorial/install-mongodb-enterprise-on-red-hat', '/tutorial/install-mongodb-enterprise-on-debian', '/tutorial/install-mongodb-enterprise-on-suse', '/tutorial/install-mongodb-enterprise-on-amazon', '/tutorial/install-mongodb-on-os-x'];
  </script></body>
</html>